i have an html form with two text boxes. one is for the product name and the other is for the price. i want the text boxes for price to allow numeric values only. is there a way of limiting user input for this text box using javascript

we can achieve your functionality by using isNaN(value_of_your text feild) function of java script

the following URL gives better idea on your requirement and how to use the isNaN() function for your script code

http://javascriptexample.blogspot.in/2008/07/isnan-function.html

let me know if you have any doubts in my clarification

happy coding

i want the check to be done when the user is entering data into that text box not when the form is submitted

there is an event called onkeypress() for the textfeild input element of html. you can call the required function on that moment like as follows

<input type="text" name="you_text_feild_name" id="you_text_feild_id" onkeypress="your_function_name()"/>

please try to call your java script function as described above

so that you will get the output as you want

let me know the status

happy coding