PDF Editing Issues

Clear Default Text on Focus in an Adobe Acrobat PDF Form Field

Elise WilliamsElise Williams Nov 19, 2026 868 views

Question details

Set a PDF form field to clear its default instructional text when the field receives focus.

Clear Default Text on Focus in an Adobe Acrobat PDF Form Field
Product
Adobe Acrobat PDF form editor
Device & OS
not provided
Scenario
A form author wants instructional text to disappear when a user clicks a text field.
Observed behavior
The field should start with instructional text and clear it when the user focuses the field.
Before you start

Open the PDF in a form editor that supports field actions and JavaScript, such as Adobe Acrobat. Identify the text field and the exact instructional text you want to display.

Solution 1Recommended

Add an On Focus JavaScript action to the PDF field

Use a field action to clear the displayed value when a user clicks into the field.

1
Open the form editor

In Adobe Acrobat, open the PDF and select All tools > Prepare a form.

2
Set the instructional text

Double-click the text field, open the Options tab, and enter the instruction in Default Value.

3
Add the focus action

In the field's Properties dialog, open Actions. Select On Focus as the trigger and Run a JavaScript as the action, then click Add.

4
Enter the script

Enter event.target.value = ""; in the JavaScript editor, then confirm the action and close the field properties.

5
Save and test

Save the PDF, exit form editing, and click the field. Type a value, click outside it, and click back in to check the focus and blur behavior.

Add an On Focus JavaScript action to the PDF field
Avoid clearing entered answers: The script clears the field every time it receives focus, including after a user has entered an answer. To clear only the instruction, use: if (event.target.value === "Enter your name") { event.target.value = ""; } Replace the quoted text with the exact default value. The instruction will not automatically return when the field loses focus. PDF viewers may also restrict or disable JavaScript.
Free Microsoft Office alternative

View and fill PDF forms alongside your Office documents with WPS Office

WPS Office is a free, lightweight alternative for working with Office files and PDFs in a familiar interface, making it easy to move between document formats. Use a PDF editor that supports JavaScript field actions to configure automatic clearing; WPS Office is an alternative for viewing and filling the form.

View and fill PDF forms in the same suite as your documentsOpen and work with Microsoft Word, Excel, and PowerPoint formatsUse a familiar interface to transition from Microsoft OfficeAccess a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

How do I keep the script from deleting a user's answer?

In the field's On Focus JavaScript action, check whether event.target.value matches the exact instructional text before clearing it. This leaves other values unchanged.

Will the instruction return if the user leaves the field empty?

No. The On Focus script only clears the value. Restoring the instruction requires additional logic, such as a separate blur action.

Why doesn't the field clear in my PDF viewer?

The viewer may not support PDF JavaScript or may have it disabled or restricted. Test the saved form in a viewer that supports JavaScript field actions and check its security settings.

Where do I change the default instructional text?

In Adobe Acrobat, select All tools > Prepare a form, double-click the text field, and change Default Value on the Options tab. If your script checks for a specific instruction, update the script to match it.