I have 3 inputs like this :
<input type="text" id ="text1"/><br>
<input type="text" id ="text2"/><br>
<input type="text" readonly="readonly" disabled="disabled" id ="text3"/>
the 3rd input is disabled and I like that his value will equal to : (val(text2)/val(text1)*100-100) whene I pass the value of the two other input
so for that I try this script :
var p1 = document.getElementById('#text1').value;
var p2 = document.getElementById('#text2').value;
document.getElementById('#text3').value = ((p1/p2)*100)-100;
but does not work , someone can help me please ?
document.getElementById('#text1')is incorrect. You don't need to have#in the selectors.document.getElementById('text1')onchangeoroninputwould work just fine.