Reputation: 9918
I have a few buttons which are generated programatically:
<button id="btn_b1" type="button" class="btn btn_default disabled">Disabled Button</button>
<button id="btn_b2" type="button" class="btn btn_default">Button</button>
The following code
$("button[id^='btn_b'][class~='disabled']")
selects <button>
elements with an id
attribute value containing the string btn_b
and class
attribute value contains disabled
.
What I want to select are
<button>
elements with an id
attribute value containing the string btn_b
and class
attribute value does not contain disabled
.
Upvotes: 0
Views: 112
Reputation: 16777
Use the :not()
pseudo class.
$("button[id^='btn_b']:not(.disabled)")
Upvotes: 1