开发者

dynamic controls javascript

开发者 https://www.devze.com 2023-02-16 04:57 出处:网络
<input type=\'text\' class=\'textbox numbers_开发者_StackOverflowonly deny_decimal pdt_qty\' maxlength=\'6\' style=\'float:left; width:70%\' value=\'\" + qty + \"\'>
<input type='text' class='textbox numbers_开发者_StackOverflowonly deny_decimal pdt_qty' maxlength='6' style='float:left; width:70%' value='" + qty + "'>

I create the above control using javascript(if i press a button), but I can enter non-numeric value in the text box. ( I have written code to restrict user to enter non-numeric values). But it does not work only for the control i created dynamically? :(


You must add more details on how you create this control and how you attach the restrictions to the control.

It seems that you are doing a document.write, it's better create a DOM element as:

var control = document.createElement("input");
control.setAttribute(...);

and so on.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号