Onclick event passing argument to js function



  • 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?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.