Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
189
rated 0 times [  194] [ 5]  / answers: 1 / hits: 36199  / 14 Years ago, wed, november 24, 2010, 12:00:00

I've got an element



<input type=text>


On this, there is an Event



onChange=myfunction(param).


param is the content of the input itself. How can I handle, that, when I fire onChange (so complete the change of the field), in this param is the actual value of this field?



Is it possible to do something like that:



onChange=myfunction(document.getElementById('this_id'))

More From » dom

 Answers
9

You can pass this to myFunction which will be the input



<input type=text onChange=myfunction(this) />


then myFunction could look like this:



function myFunction(obj)
{
var value = obj.value; // the value of the textbox
}

[#94859] Sunday, November 21, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sherryd

Total Points: 254
Total Questions: 92
Total Answers: 89

Location: Equatorial Guinea
Member since Sun, Feb 14, 2021
3 Years ago
;