开发者

jQuery - Trouble passing a variable into input:radio[name]

I'm havin开发者_如何转开发g trouble passing a variable in the following

var whichRbClicked = $('input:radio[name=RBname]:checked').val();

where RBname is the variable.

Any help or advise would be MUCH appreciated. TIA


Should be:

var whichRbClicked = $('input:radio[name=' + RBname + ']:checked').val();

For more info, check out:

  • Concatenating strings with the + operator
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜