Jquery:How to use variable as a selector

前端 未结 1 1010
余生分开走
余生分开走 2020-12-12 02:58

I trying to figure out how can I use a variable inside a selector. If I use the actual value of the ID in the selector, it works very well.

$(document).on(\"         


        
相关标签:
1条回答
  • 2020-12-12 03:21

    Basic string concatenation:

    $('div[data-id=' + data-id + ']')
    
    0 讨论(0)
提交回复
热议问题