[jQuery] Custom Expressions / shortcut for hover.addClass, removeClass
Choan mentioned the documentation on "custom expressions", found here:
http://jquery.com/docs/CustomExpressions/
I like the custom selectors, I think they are very useful.
The custom elements expression, on the other hand, are somewhat dangerous.
What if I use the $() to retrieve an radio element from my xml data? Nothing
gets selected, because jQuery searches for <input type="radio"/>? What if I
want to select all input elements, but not select or textarea?
And now for something completly different:
I have seen the following code snipped quite often in this mailing list:
$('some element selection').hover(
function() { $(this).addClass('someClass'); },
function() { $(this).removeClass('someClass'); }
);
Maybe its time for some kind of this:
$('some element selection').hover.toggleClass('someClass');
I'm not sure how the syntax of such a shortcut would be best, maybe someone
has an idea.
-- Jörn
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/