javascript - Passing a string value from c# file to js file -
i trying pass string value c# file js file.
if try pass int value, can pass it, unable pass string value.
string value = "abc"; int a=5; tablecell.attributes.add("onclick", "f1("+value +")"); //nothing happens tablecell.attributes.add("onclick", "f1("+a +")"); //works
js file
function f1(value) { alert(value); }
pass string value in quotes ''
use
tablecell.attributes.add("onclick", "f1('"+value +"')"); ^ ^
otherwise treated variable. must getting error in browser console.
Comments
Post a Comment