I’ve written some small code that provides a pretty basic functionality and it uses the default jQuery selection methods. It works like this:
There are 2 li’s which wrap a link. When the link is clicked, jQuery cheks if the li has a certain css class; if not, it performs the required action.
Frankly it works only when the second li doesn’t have this class, not when the first hasn’t.
Can anyone tell why this happens and how it could be solved?
jsfillde is here and makes things much clearer: http://jsfiddle.net/EDa7n/
You’re only binding the click function to anchor tags which aren’t active.
You need to bind to them all and within the click function, check if the class is active.
http://jsfiddle.net/jimschubert/EDa7n/1/