Showing posts with label implement. Show all posts
Showing posts with label implement. Show all posts

Thursday, 25 February 2016

How to Change Form Field Value With JavaScriptIn Feburary 2016 25,

In Feburary 2016 25,
Open a text editor and create a new file named fillForm.html. Add some HTML tags to the file that include an open '
' tag, an open '
' tag, a closing '
' tag, an open '
' tag, a closing '
' tag, and a closing '
' tag. Together, these tags implement a basic HTML page.
Add a '
Add a JavaScript function between the '' tags. Name the function fillForm() and include an open curly brace '{' and a close curly brace '}' to indicate where to place the function's code.
Edit the fillForm() function and use a getElementById JavaScript function to set the value of the input field with the id value 'formToFill' to the text 'Changed Value'.
Type a '' tag and save fillForm.html.
Add a '
' HTML tag to the file and add an onClick() event to the button that calls the fillForm() function. Set the button's text to 'Click to change the value in the formToFill input field.'. Close the '
' tag and save and close fillForm.html.
Open the file in a web browser and click the button to change the text in the form field from the text 'Original Value' to 'Changed Value'.
In Feburary 2016 25,