Jump to content

kebrus

Members
  • Posts

    4
  • Joined

  • Last visited

kebrus's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. hey everyone, i've just register to clarify this doubt that i havei hope there is no problem on posting DOM questions herei'm working on a script in which i need to create an attribute to a tag element, i can do it fine fine with the createAttribute function and setAttribute, my question here is that my attribute is the normal "class" HTML attributei thought that elementeVarName.class = "blabla"; would work but it doesn't (i've searched everywhere in w3schools and i can find the .id the .name but not the .class)instead i have to do this var a = document.createAttribute('class');a.nodeValue = 'blabla';elementeVarName.setAttributeNode(a); now think of multiplying this code over and over just for the "class" attribute why the first doesn't exist? is there any simplier way?[edit]obviously i created a function to do it, but i still looking for an answer [/edit]
×
×
  • Create New...