javascript - Clicking a link will provide an additional text box/input field -
The current design of one of the pages of my application is such that there is an input field "email" where we provide multiple Separate email addresses can provide user email IDs and update the database by clicking the "Update" button.
I have to give it a new look in such a way that now for each email address, I must provide a separate input field, there should be a link to the right of the existing "Email" input field ("Add More" Click on this link, "Add more" will give you a new textbox / input filed under the current "Email" field. Clicking on the link again will give you an additional input field where I can provide an email ID. Similarly, we can add up to 10 input fields for different email IDs.
Can you please tell me how to design it. And how we will verify that we can not add more input fields after 10
Use .
(or any jQuery utility functions) to add a new HTML element:
& lt; Button onclick = "add ()" & gt; Add & lt; / Button & gt; & Lt; Div id = "email" & gt; & Lt; Div & gt; & Lt; Input type = "text" / & gt; & Lt; Button onclick = "del (this)" & gt; Remove & lt; / Button & gt; & Lt; / Div & gt; & Lt; / Div & gt; Var numAdd = 1; Var add = function () {if (numAdd> = 10) returns; $ ('# Email'). Endend (" button> onclick =" del (this) "& gt; delete & lt; / Div & gt;); NumAdd ++; }; Var del = function (BTN) {$ (BTN). Parent (). Remove (); };
Comments
Post a Comment