Skip to content
Advertisement

How to get the button text through calling a method

I am working on this demo. Why am I not getting the text of the #add-point button?

JavaScript
JavaScript

Advertisement

Answer

You don’t have any “this” in your function. You either need to pass it to your function or execute your code in the on click function. The this is a really important feature to master when coding in JS.

Reference: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/this

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement