javascript - Jquery Uncaught SyntaxError: Unexpected token } - Trying to pass guid as parameter - Stack Overflow

Hi I am trying to pass guid to a function but it gives me error,Uncaught SyntaxError: Unexpected token

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
Add a ment  | 

1 Answer 1

Reset to default 8

You need to escape stating and closing quotes of onclick=""

var callFunction = "<tr class='MenuRow' onclick=\"myFunctionabc('" + gg + "')\"></tr>"

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745640132a4637640.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信