[英]How to add text boxes dynamically when one text box is filled?
I have text box to fill the ph.numbers in that, here what i want is, whenever i'm entering the value in that text box i need to add another empty text box dynamically where i can add another value in that in the same way if they are entering any value into this new empty box another empty text box should add at the bottom of this. 我有一个文本框来填充ph.numbers,这是我想要的,每当我在那个文本框中输入值时,我都需要动态添加另一个空文本框,在其中我可以在同一位置添加另一个值如果他们要在此新的空框中输入任何值,则应在此底部添加另一个空文本框。 And after all there is a confirm link button.
毕竟还有一个确认链接按钮。 When clicking on it all these ph.numbers entering on the text boxes should get.
单击它时,应在文本框中输入所有这些ph.number。 How is it possible?
这怎么可能?
You add textboxes dynamically using jquery and on the button click/submit there values to the server. 您可以使用jquery动态添加文本框,然后在按钮上单击/将那里的值提交给服务器。 What you can do is on keyup event of a textbox you can add another below it.
您可以做的是在文本框的keyup事件中添加另一个文本框。
Try this. 尝试这个。
I'm basing this condition that your number format is of 11, Ex: 09123456789 我基于此条件,您的数字格式为11,例如:09123456789
So on the Textbox_Textchanged event of your textbox. 因此,在文本框的Textbox_Textchanged事件上。
if(textbox.text.length >= 11)
{
Textbox text = new Textbox();
text.TextChanged += Textbox_Textchanged; // So it would also trigger the event
// Do positioning here
}
Im thinking you can better optimize this by having a better EventArgs but you get the idea right? 我认为您可以通过拥有更好的EventArgs来更好地优化此功能,但是您的想法正确吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.