05-26-2009 03:15 PM - edited 05-26-2009 04:19 PM
Currently researching Blackberry Browser software solution and have found an issue. I am creating a html input text via asp.net and attach an onchange event to the list. Upon onchange I simply want to display the id of the text box that generated fired the onchange
Attempts made....
alert(Event.currentTarget); = empty alert
alert(Event.currentTarget.id);= no alert. I assume an exception is thrown behind the scence.
Anyone from RIM care to comment? How can I get the id of the element that triggered the event? The preferred method would be W3C compliant.
Thanks,
smorton
Solved! Go to Solution.
05-26-2009 11:41 PM
05-27-2009 08:08 AM
Using an external js file this seems to work. elementId is a global var in the js file.
<input name="bla" type="text" id="bla" onchange="elementId=this.id; someObject.method();" value="7.00" />
That being said I don't like this solution. I agree e.currentTarget would be the best approach e doesn't exist in the BB. Am I missing something?
05-27-2009 12:25 PM
Hello
I would pass the id in the method parameter.
onchange="someObject.method(this.id)"
I'm not sure that the event.currentTarget.id would work for a text box, I don't think this method works in IE.
Andrew
05-27-2009 01:25 PM
05-28-2009 07:48 AM
05-28-2009 08:34 AM
Excellent. I thought I had tried that already but I think I had the event reference in my external js file which would have flawed the test.
Thanks