Issue
Suppose I've Textbox and Button. I want to show String "Hello World" in Textbox after Clicking the Button. How to do it?
Solution
You need one button onclick of ClickMe button you need to initiate onclick Listener which update the content to text field:
function setFieldValue(){
document.getElementById('firstName').value="Hello World";//this is text set when button clicked
}
<!DOCTYPE html>
<html>
<body>
First name: <input type="text" id="firstName" name="firstName"><br>
<input type="submit" value="ClickMe" onclick="setFieldValue()">
</body>
</html>
Answered By - Anand Dwivedi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.