About 52 results
Open links in new tab
  1. javascript - How to add a class to a given element? - Stack Overflow

    Nov 28, 2016 · What does adding a class to a DOM element have to do with learning the language? document.getElementById ('div1').className is as much a library related issue as using jQuery to do …

  2. How can I add a class to a DOM element in JavaScript?

    48 3 ways to add a class to a DOM element in JavaScript There are multiple ways of doing this. I will show you three ways to add classes and clarify some benefits of each way. You can use any given …

  3. how to append a css class to an element by javascript?

    Suppose a HTML element's id is known, so the element can be refereced using: document.getElementById(element_id); Does a native Javascript function exist that can be used to …

  4. javascript - Add class to an element - Stack Overflow

    Jun 26, 2012 · Add class to an element Asked 15 years, 11 months ago Modified 4 years, 2 months ago Viewed 40k times

  5. How to add/remove a class in JavaScript? - Stack Overflow

    Since element.className property is of type string, you can use regular String object functions found in any JavaScript implementation: If you want to add a class, first use String.indexOf in order to check if …

  6. How to add and remove classes in Javascript without jQuery

    Nov 4, 2014 · I'm looking for a fast and secure way to add and remove classes from an html element without jQuery. It also should be working in early IE (IE8 and up).

  7. javascript - Add and remove class on click - Stack Overflow

    Using this code, the class will be added only on the element that was clicked and will not effect other elements in question.

  8. How can I change an element's class with JavaScript?

    How can I change the class of an HTML element in response to an onclick or any other events using JavaScript?

  9. Add class to <html> with Javascript? - Stack Overflow

    Dec 20, 2012 · How do you add a class to the &lt;html&gt; root element using Javascript?

  10. html - Add a class to a DIV with javascript - Stack Overflow

    Jul 12, 2012 · Add a class to a DIV with javascript Asked 13 years, 6 months ago Modified 4 years, 10 months ago Viewed 116k times