Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
136
rated 0 times [  140] [ 4]  / answers: 1 / hits: 149514  / 12 Years ago, fri, june 29, 2012, 12:00:00

I want to set an HTML field's value using JavaScript when onclick event is raised by clicking a button/hyperlink.. I Googled and found many articles using the name attribute, but I want to set the value using the field's id only.


More From » html

 Answers
1
document.getElementById('Id').value='new value';


https://developer.mozilla.org/en-US/docs/Web/API/document.getElementById


[#84577] Thursday, June 28, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
magdalena

Total Points: 364
Total Questions: 101
Total Answers: 92

Location: Namibia
Member since Mon, Nov 14, 2022
2 Years ago
;