javascript - Is it possible to add an event listener to the small buttons in a number input box? -


if example had input box in shopping basket asking quantity of product, add event listener small buttons right of number in <input type=number> field change number accordingly , update price.

if possible example great.

thanks.

edited

i stay clear of jquery please if possible

you can use javascript change event:

document.getelementbyid("product").addeventlistener("change", function( event ) {     console.log(event.target.value);   }, false); 

demo

updating price changing value of product:

document.getelementbyid("product").addeventlistener("change", function( event ) {     var product = parseint(event.target.value);     document.getelementbyid("price").value = product *2;   }, false); 

demo


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -