I am trying to add a jquery selector which finds: all data-toggle=collapse which dont have a class of no-hide
I try which doesn't select anything.
$('[data-toggle=collapse]:has(.no-hide)').click(function(){
Error: $(...).hasClass(...).click is not a function
$('[data-toggle=collapse]').hasClass("no-hide").click(function(){
Only works if there is 1 class name.
$('[data-toggle=collapse][class=no-hide]').click(function(){
You can use not method:
$('[data-toggle=collapse]').not(".no-hide").click(function(){
Update: If you want to select the elements that have no-hide class, you can use filter method:
$('[data-toggle=collapse]').filter(".no-hide").click(function(){
try not
$('[data-toggle=collapse]').not(".no-hide").click(function(){
//your stuff
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With