On 3/5/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

What is the jQuery syntax to ge the class name of an item with a known id?


var myClassAttr = $("#myId").attr("class");

Will store the entire contents of #myId's "class" attribute in the variable
"myClassAttr"

If you want to determine whether #myId has a particular class or not use
this:

if( $("#myId").is(".myClass") ) {
   // Do stuff...
}

--
Aaron Heimlich
Web Developer
[EMAIL PROTECTED]
http://aheimlich.freepgs.com
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to