skip to Main Content

Html – how to find sum of input value in javascript

Can anyone help me to find sum of input values using JavaScript. The HTML and JavaScript is given below. Thanks in advance let inputs=document.getElementsByTagName('input'); let button=document.querySelector('button'); button.addEventListener('click',function(){ let sum=''; for(let i=0;i<inputs.length;i++){ sum+=parseInt(inputs[i].value); } console.log(sum); }) <input type="text"> <input type="text"> <button>Find…

VIEW QUESTION

Jquery – single form and multiple submit (with multiple value)

I Have a "For Loop" In ASP.NET Core Like This : <button type="submit" Form="FormActive" name="id" value="@item.I"></button> <!--It Will Create SomeThing Like This:--> <button type="submit" Form="FormActive" name="id" value="1"></button> <button type="submit" Form="FormActive" name="id" value="2"></button> <button type="submit" Form="FormActive" name="id" value="3"></button> ... ... ...…

VIEW QUESTION
Back To Top
Search