0

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

2
Contributors
3
Replies
9
Views
4 Years
Discussion Span
Last Post by radhakrishna.p
0

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

0

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

Edited by radhakrishna.p: giving clarity on the solution

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.