I want to find a div with a class associated with it, but it must not be disabled.
I am using following code for getting the next sibling, but it will return the next element with the “menuDiv” class.
var nextDiv=jQuery('div.subMenuBarhover').nextAll('.menuDiv:first');
but now I need the element which is not disable and id of all element is unkown.
How can I achieve this?
You said you are using a custom attribute to mark a
divas disabled. I would recommend to always usedata-*attributes for custom attributes, i.e.To select the next
divwithout that attribute, use the negation pseudo class (aka:notselector) and the attribute selector:If you want to find the next element where the
data-disabledattribute has a certain value, use the attribute-equals selector:In general, have a look at all the existing selectors have try them out!