Code:
// inside for loop..
$("#tabs").append('<li><a href="#tab' + 1 + '">' + 1 + '</a><img src="/Images/pdf.png" onclick="test('1s')" /></li>');
function test(val) {
alert(val);
//return false;
}
Please see this code onclick="test('1s')". Is there any syntax wrong?. I am not able to pass the value 1s to the test function.
But I can pass the value if it is 1 instead of 1s.
UPDATE:
How to pass a variable value...Lets say 1s is in variable val.. If I put onclick="test(\'val\')", I am getting the val as "val" instead of 1s
SOLUTION:
I solved myself..Refer to https://stackoverflow.com/a/32945494/5409139