How to select html nodes by ID with jquery when the id contains a dot?

后端 未结 8 1066
生来不讨喜
生来不讨喜 2020-11-22 08:22

If my html looked like this:


    

        
8条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 08:41

    attr selection seems to be appropriate when your ID is in a variable:

    var id_you_want='foo.bar';
    $('[id="' + id_you_want + '"]');
    

提交回复
热议问题