Combining a class selector and an attribute selector with jQuery

后端 未结 4 964
轻奢々
轻奢々 2020-12-12 14:56

Is it possible to combine both a class selector and an attribute selector with jQuery?

For example, given the following HTML:



        
4条回答
  •  爱一瞬间的悲伤
    2020-12-12 15:13

    I think you just need to remove the space. i.e.

    $(".myclass[reference=12345]").css('border', '#000 solid 1px');
    

    There is a fiddle here http://jsfiddle.net/xXEHY/

提交回复
热议问题