Pass multiple values with onClick in HTML link

后端 未结 8 1583
眼角桃花
眼角桃花 2021-02-04 03:50

Hi Im trying to pass multiple values with the HTML onclick function. Im using Javascript to create the Table

var user = element.UserName;
var valuationId = eleme         


        
8条回答
  •  一整个雨季
    2021-02-04 04:12

    Solution: Pass multiple arguments with onclick for html generated in JS

    For html generated in JS , do as below (we are using single quote as string wrapper). Each argument has to wrapped in a single quote else all of yours argument will be considered as a single argument like functionName('a,b') , now its a single argument with value a,b.

    We have to use string escape character backslash() to close first argument with single quote, give a separator comma in between and then start next argument with a single quote. (This is the magic code to use '\',\'')

    Example:

    $('#ValuationAssignedTable').append(' Re-Assign   ');
    

提交回复
热议问题