Absolutely Karl -
the is() method is wonderful, I use it quite often. But there are often more
ways to achieve the same things, sometimes it's just a matter of taste.
Anyway - a hasClass method would probably even save a few ms compared to
is() in my opinion, because you don't need to parse stuff.
2007/3/4, Karl Swedberg <[EMAIL PROTECTED]>:
Maybe .hasClass() would be helpful, but keep in mind that .is() offers
/more/ functionalities than .hasClass() would.
For example ...
$('.class').is('#my-id')
$('p').is(':visible')
$('div').is('[a]')
I'm not necessarily opposed to having .hasClass(), but I really love the
flexibility of .is().
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Mar 4, 2007, at 10:07 AM, Sébastien Pierre wrote:
Hi,
This is not very obvious, and I guess some people won't notice that
"is" offers the same functionalities as a potential "hasClass"...
from a "developer friendly" point of view, I think it would be better
to have addClass/toggleClass/hasClass rather than addClass/
toggleClass/is.
Just my 2c ;)
-- Sébastien
Le 07-03-02 à 13:30, John Resig a écrit :
give this a try:
$(node).is(".class")
--John
On 3/2/07, Sébastien Pierre <[EMAIL PROTECTED]> wrote:
Hi all,
I was wondering if somebody would be interested in a hasClass(...)
function for jQuery. I would definitely find it useful, and am
willing to contribute it.
-- Sébastien
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
--
--
Paul Bakaus
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/