admin管理员组文章数量:1435777
Hi I am trying to pass guid to a function but it gives me error,
Uncaught SyntaxError: Unexpected token }
var gg = "someGuid";
var callFunction = "<tr class='MenuRow' onclick='myFunctionabc('" + gg + "')'></tr>"
function myFunctionabc(abcd){
alert(abcd);
}
I am trying on Chrome, any clue ?
Edit
Sorry for some people who don't know what's GUID, its a number like this "0a6bb960-97c4-4099-8e0a-cc5cc81ed451"
Hi I am trying to pass guid to a function but it gives me error,
Uncaught SyntaxError: Unexpected token }
var gg = "someGuid";
var callFunction = "<tr class='MenuRow' onclick='myFunctionabc('" + gg + "')'></tr>"
function myFunctionabc(abcd){
alert(abcd);
}
I am trying on Chrome, any clue ?
Edit
Sorry for some people who don't know what's GUID, its a number like this "0a6bb960-97c4-4099-8e0a-cc5cc81ed451"
Share Improve this question edited Jan 7, 2014 at 16:29 Change asked Jan 7, 2014 at 16:25 ChangeChange 4381 gold badge7 silver badges24 bronze badges 2- are you adding the tr to a table – Arun P Johny Commented Jan 7, 2014 at 16:27
- @RocketHazmat really ? by someGuid I meant GUID... which looks like this "0a6bb960-97c4-4099-8e0a-cc5cc81ed451" – Change Commented Jan 7, 2014 at 16:29
1 Answer
Reset to default 8You need to escape stating and closing quotes of onclick=""
var callFunction = "<tr class='MenuRow' onclick=\"myFunctionabc('" + gg + "')\"></tr>"
版权声明:本文标题:javascript - Jquery Uncaught SyntaxError: Unexpected token } - Trying to pass guid as parameter - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745640132a2667805.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论