skip to Main Content

jQuery calculation return NaN on change input text

I have this code to make some calculation when I change the inputs fields: <div class="card-body"> <div class="form-group"> <label>Pret vanzare</label> <input id="price_vanzare" type="text" name="price" class="form-control" placeholder="Product price" value="<?php echo $product->price; ?>"> </div> <div class="form-group"> <label>Pret achizitie</label> <input id="price_achizitie" type="text" name="price_achizitie"…

VIEW QUESTION

Javascript, keypress if i use it when i want user input to be added in a list only one character i.e., the latest pressed key shows up

i wanted to add a userinput in a todo list using keypress but only one character is taken by the input filed. this is the code: input.addEventListener("keypress", function(event){ if(input.value.length>0 && event.key === 'Enter'){ var li = document.createElement("li"); li.appendChild(document.createTextNode(input.value)); ul.appendChild(li); }…

VIEW QUESTION
Back To Top
Search