Form input value | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Form input value

Anybody help me i created a Interest Calculator but after submitting form i am expecting to Blank all my input fields of form i used input.value=" " but it didn't work for me.

27th Jul 2022, 6:59 AM
Rizwan Ahmad
Rizwan Ahmad - avatar
2 Respostas
+ 1
Could you please share the code with us? It will be easier to find the issue.
27th Jul 2022, 7:32 AM
šŸ‡ Alex Tușinean šŸ’œ
šŸ‡ Alex Tușinean šŸ’œ - avatar
0
console.log("Script is working"); //let subBtn = document.getElementById('subBtn'); let fSubmit = document.getElementById('fSubmit'); //Making function for getting Calculation of Interest fSubmit.addEventListener('submit', function(e) { e.preventDefault(); let pRate = document.getElementById('pRate').value; let Interest = document.getElementById('Interest').value; let Year = document.getElementById('Year').value; let h1 = document.querySelector('h1'); let simpleInterest = (pRate*Interest*Year)/100; h1.innerHTML = "The interest is: "+ simpleInterest; console.log(simpleInterest); pRate.value = " "; Interest.value = " "; Year.value = " "; });
27th Jul 2022, 2:29 PM
Rizwan Ahmad
Rizwan Ahmad - avatar