Word for the web preserves field codes already in your document, but it doesn’t provide a way to add them or edit them.
Instead, if you have the Word desktop application, use the Open in Desktop App command to open the document and insert or edit field codes.
When you’re done and you save the document, it will continue to store the field codes when you open it in Word for the web.
To learn more, see Field codes in Word. If you don’t have Word, you can try or buy it in the latest version of Office now.
Tip: Word for the web works seamlessly with Word and other Office desktop programs, and we update it based on input like yours. For the latest feature announcements, visit the Office Online blog.