The moose likes HTML, CSS and JavaScript and the fly likes Put javascript function value into input tag value Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Put javascript function value into input tag value" Watch "Put javascript function value into input tag value" New topic
Author

Put javascript function value into input tag value

michael yue
Ranch Hand

Joined: Nov 20, 2003
Posts: 204
How can I put a value returned from a javascript function into the value of a input tag.
example
<input name="ingroup1" type="hidden" value=getGrp()>
where getGrp() is the javascript function as below
function getGrp()
{
var thegrp = document.f0.ingroup.value;
return thegrp;
}
The value passed is getGrp() instead of the real value.
Thanks.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
it needs to called, you are not calling it...
<input name="ingroup1" type="hidden" onload="this.value=getGrp()">
Eric
 
 
subject: Put javascript function value into input tag value
 
Threads others viewed
Fiding the error
Process Custom tag based on the given input from html (same page)
which button is clicked
Use Value of Another Tag in Onclick Event
Javascript and "value=" attribute of input tag.
IntelliJ Java IDE