javascript - event listen for click in HTML getting the value -


Trying to reprogram a calculator using Event Listener because this code should be better overall.

and here is the code

  

code> var input = document.getElementById ("calculator"). AddEventListener ("click", Calc); Function calc (a) {input = this.a; Console.log (input); }

Thank you for your time

you want something like this I thought that calc is near event item, through which you can take the price.

  function calc (a) {var input = A.target console.log (input.value); }   

Edit:

After looking at Bella, calculator turned out to be a div, do not know what you try to achieve are doing .

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -