About 35,200,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. 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 …

  3. javascript - How to access the correct `this` inside a callback - Stack ...

    Nov 29, 2013 · Functions are first-class citizens in JavaScript and the term "method" is just a colloquial term for a function that is a value of an object property. But that function doesn't have a specific link …

  4. 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, …

  5. javascript - Get name of object or class - Stack Overflow

    10 As this was already answered, I just wanted to point out the differences in approaches on getting the constructor of an object in JavaScript. There is a difference between the constructor and the actual …

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

  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 - JS getters and setters inside a class? - Stack Overflow

    I'd like to create a class in JS that uses native getters and setters. I know I can create getters/setters for objects, like so: var obj = { get value () { return this._value; }, ...

  9. 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...

  10. class - Javascript ES6 - Enums inside classes used outside like a ...

    The static getter in the third example above must be accessed by the class or class constructor, not a class instance. To get a class from an instance, use the constructor: Box.constructor.STATES.WIP. …