HTML
<input name="pm" type="text" value="0"/>
<input name="pm" type="text" value="0"/>
<input name="pm" type="text" value="0"/>
<input name="total" type="text" value="0" disabled="disabled"/>
Javascript
$('[name="pm"]').keypress(function() {
//implementation ?
});
I have three text box by default value =0, as user write any one of the these three text box, total must be shown in total text box.
Key press event working fine for all three text boxes.
Simple demo http://jsfiddle.net/mZBtg/
Please note: I have used
keyupapi but it will give you same result what you are looking for.http://api.jquery.com/keyup/
http://api.jquery.com/keypress/
You can also do
isNumericandisNancheck; good link: $.isNumeric vs. isNaN Also please see comments below. B-)Feel free to play around and hope this help.
code