[jQuery] How to detect an element's class name?

2006-12-12 Thread luogz
Dear All,
I'm a newbie of jQuery, I got a problem,can anyone give me a hand?
My problem is:
How can i get the class name of  an element?









┈ 
  国忠 -Terry Luo - UED,Yahoo! China
┈
 ・Y!messenger: lovinglgz
 ・Email:  [EMAIL PROTECTED]
 ・Tel: +86 10 6598 5997
 ・Mobile: +86 1358 152 3051
┈ 
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to detect an element's class name?

2006-12-12 Thread Blair McKenzie

Actually getting the class value isn't as usefull as it might seem at first
glance because elements can have multiple classes - i.e. div class=note
selected mouseover/div. This means that if you did get the value, you'd
have to do all sorts of gymnastics to check for what you want. It's much
better to use the functions built into jQuery.

To check if an element has a given class:
$(#someelementid).is(.yourclass)

If you have a list of elements, but only want the ones with a given class:
$(div).filter(.yourclass)

Blair

On 12/13/06, luogz [EMAIL PROTECTED] wrote:


 Dear All,
I'm a newbie of jQuery, I got a problem,can anyone give me a hand?
My problem is:
How can i get the class name of  an element?









┈
  国忠 -Terry Luo - UED,Yahoo! China
┈
 ・Y!messenger: lovinglgz
 ・Email:  [EMAIL PROTECTED]
 ・Tel: +86 10 6598 5997
 ・Mobile: +86 1358 152 3051
┈

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to detect an element's class name?

2006-12-12 Thread johnnybai

hi,

p class=abc

$(.abc) or $(p.abc)

you'd better to see the jquery api document:)

Johnny

On 12/13/06, luogz [EMAIL PROTECTED] wrote:


 Dear All,
I'm a newbie of jQuery, I got a problem,can anyone give me a hand?
My problem is:
How can i get the class name of  an element?









┈
  国忠 -Terry Luo - UED,Yahoo! China
┈
 ・Y!messenger: lovinglgz
 ・Email:  [EMAIL PROTECTED]
 ・Tel: +86 10 6598 5997
 ・Mobile: +86 1358 152 3051
┈

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/