About 32,400,000 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. syntax - class variable in Javascript - Stack Overflow

    Jun 18, 2016 · JavaScript does not have classes like others have said. Inheritance is resolved through prototyping which in essence does nothing more than create non-deletable property references on a …

  3. javascript - How do I make a "public static field" in an ES6 class ...

    Feb 11, 2015 · I'm making a Javascript class and I'd like to have a public static field like in Java. This is the relevant code: export default class Agent { CIRCLE: 1, SQUARE: 2, ...

  4. What techniques can be used to define a class in JavaScript, and what ...

    Dec 23, 2008 · The best way to define a class in JavaScript is to not define a class. Seriously. There are several different flavors of object-orientation, some of them are: class-based OO (first introduced by …

  5. 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?

  6. JavaScript click event listener on class - Stack Overflow

    Aug 9, 2016 · I'm currently trying to write some JavaScript to get the attribute of the class that has been clicked. I know that to do this the correct way, I should use an event listener. My code is as follows...

  7. Check if an element contains a class in JavaScript?

    Using plain JavaScript (not jQuery), Is there any way to check if an element contains a class? Currently, I'm doing this: var test = document.getElementById("test"); var testClass = test.cla...

  8. javascript - What is the "get" keyword before a function in a class ...

    28 It is getter, same as Objects and Classes in OO JavaScript. From the MDN Docs for get: The get syntax binds an object property to a function that will be called when that property is looked up.

  9. javascript - How can I invoke asynchronous code within a constructor ...

    Apr 16, 2017 · JavaScript class es can return literally anything from their constructor, even an instance of another class. So, you might return a Promise from the constructor of your class that resolves to …

  10. javascript - How to test if something is a class? - Stack Overflow

    if the argument is a class name, it means it is a string. if the argument is a class, then you can test instances of class with instanceof, but you can not test classes with instanceof. In your example, …