PDA

View Full Version : onclick event passing argument to js function



dyngoman
10th September 2011, 13:51
I want to be able to pass an attribute to the javascript function from the element on wick i click .
…
<button type=button value=“MyButtonValue”>
… function someFunction(argument) { var elm_val = argument.target.getAttributeNS(null,‘valueâ €™); myObject.setText(elm_val); }

myObject is the name of the object I addToJavaScriptWindowObject;
setText is a slot of that object that show a messagebox.

I want argument to be the web element I click on.
Could it be done in another way?