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

Android Studio – How To Return Nested Variable?

I don't know how to RETURN variable from the following function. Here is the code... downloadData.setOnClickListener { val handler = Handler(Looper.getMainLooper()) handler.post { val fetchData = FetchData("http://localhost/xampp/CRM/PHP/show_contacts_db.php") if (fetchData.startFetch()) { if (fetchData.onComplete()) { val result = fetchData.data.toString() Log.i("FetchData", result) val…

VIEW QUESTION
Back To Top
Search