Woppi
Woppi

Reputation: 5431

YUI Get class name by id

Is there a syntax for getting the class name by id. The class name is dynamic so I can't use

if(Dom.hasClass('id-name-here', 'class-name-here')
{
  Dom.removeClass('id-name-here', 'class-name-here');
  Dom.addClass('id-name-here', 'class-name-here');
}

I can get the src attribute using the id by doing this,

Dom.get('id-name-here').src

But when I try to adapt it to class, it is undefined

Dom.get('id-name-here').class

I am only certain of the id. Can you point me to the right documentation or teach me how...Thank you!

Upvotes: 1

Views: 2562

Answers (1)

Sarfraz
Sarfraz

Reputation: 382696

I think, it is className rather than class:

Dom.get('id-name-here').className;

Upvotes: 5

Related Questions