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

Phpmyadmin – why multiply two column in sql is not equals to sum(column1 * column2)

if have these tables : orders(amount,unit_price,child_amount,child_price,service_id,issue_date,is_success) pools(name,for_view) services(id,pool_id) when i run this sql : SELECT SUM(orders.amount) AS totalAmount, SUM(orders.unit_price) AS totalPrice, SUM(orders.amount*orders.unit_price) AS total, SUM(orders.child_amount) AS totalAmountC, SUM(orders.child_price) AS totalPriceC, SUM(orders.child_amount*orders.child_price) AS totalC, pools.name, pools.for_view FROM orders INNER JOIN services…

VIEW QUESTION
Back To Top
Search