jQuery: select an element's class and id at the same time?

前端 未结 6 1477
难免孤独
难免孤独 2020-11-27 10:35

I\'ve got some links that I want to select class and id at the same time.

This is because I\'ve got 2 different behaviours. When a class of links got one class name

6条回答
  •  一整个雨季
    2020-11-27 11:21

    You can do:

    $("#country.save")...
    

    OR

    $("a#country.save")...
    

    OR

    $("a.save#country")...
    

    as you prefer.

    So yes you can specify a selector that has to match ID and class (and potentially tag name and anything else you want to throw in).

提交回复
热议问题