How to get sum of multiple textbox values using only java script | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to get sum of multiple textbox values using only java script

Hi, I'm working on a project in which I need to sum about 12 text box values onkeyup event using JavaScript Plz help me.. Thanks in advance

7th Sep 2020, 6:19 PM
Er Mahesh Barmate
Er Mahesh Barmate - avatar
4 Answers
+ 4
You will get the result when you keyup in last box. get last box As var last = document.getElementById("lastdiv"); last.addEventListener("keyup",()=>{ //Get value of all boxes using .value as na,bb,nc,..... var sum = na+nb+nc+.....; Console.log(sum); }); If it's not clear to you first complete dom of js. You have started js it not mean that you can do everything in js. If you completed js then you can do anything there . So firstly go through it.
7th Sep 2020, 6:38 PM
Divya Mohan
Divya Mohan - avatar
+ 3
Hi what is your attempt so far ,can we see the code so we can guide you better ?
7th Sep 2020, 6:30 PM
Abhay
Abhay - avatar
+ 1
rudolph flash yes I understand the code... Actually u gave me what I wanted...
7th Sep 2020, 7:12 PM
Er Mahesh Barmate
Er Mahesh Barmate - avatar
0
Thanks rudolph flash , I'll try this code, I hope it may work for me..
7th Sep 2020, 7:01 PM
Er Mahesh Barmate
Er Mahesh Barmate - avatar