简体   繁体   English

填充一个文本框后如何动态添加文本框?

[英]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.

相关问题 如何在动态创建的文本框中添加水印? - How to add watermark to dynamically created text boxes? 当用户在任一文本框中输入值时,如何验证多个文本框,他可以提交表单 - how to validate mulitple text boxes when user enters value in any one of the text box he can submit the form 如何动态创建文本框和按钮并从c#中的每个文本框中获取值? - How to create text boxes and buttons dynamically and get the value from each text box in c#? 如果一行中的其他任何文本框都已填写,则是否需要连续一行文本框? - Make text boxes in a row required if any other text box of a row is filled? 动态添加带有相应组合框的文本框 - Add text box with corresponding combo box dynamically 单击按钮时动态添加新文本框 - Dynamically add a new text box when clicking a button 使用单个复选框动态禁用一堆文本框 - Disabling bunch of Text Boxes dynamically using a single Check Box UWP 组合框值动态生成文本框 - UWP Combo Box values dynamically generates text boxes 将视图绑定到IEnumerable时如何在MVC中添加文本框? - How to add text boxes in MVC when binding a view to an IEnumerable? 需要填写一些文本框,但不是全部 - Require some text boxes to be filled in but not all
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM