| Recommend this page to a friend! |
| All requests |
> | Dynamically add and remove textbox | > | Request new recommendation | > | > |
by sushma - 9 years ago (2016-06-16)
+3 | I want to add and remove textboxes using jquery. If I remove any row I want to restore value of deleted textbox into the previous textbox. |
3.
by Christian Vigh - 9 years ago (2016-06-21) Reply
I have made a jQuery component that is able to add and remove form components, or group of components, including text boxes, radio button groups, file upload fields and so on. It is available here :
http://www.jsclasses.org/package/467-JavaScript-Allow-the-user-to-add-repeated-form-inputs.html
Buttons are displayed to the end user to allow him to add or remove groups. You can even limit the number of form field groups that can be added/displayed. I don't know if you had this in mind, but you can have a look on the source code to figure out how such a thing can be done.
Anyway, if you have any question, please feel free to contact me.
2.
by Manuel Lemos - 9 years ago (2016-06-21) Reply
This is more for a JavaScript solution.
There is a package in JSClasses that seems to do what you want. Add or remove form inputs dynamically from pages.
1.
by Leonardo Mauro Pereira Moraes - 9 years ago (2016-06-18) Reply
Simple Solution: You can put a copy into <div 'hidden'> and when the user click in a button 'new' call a function new_btn();
function new_btn(){ var cpy_input = $('<div 'hidden'>').html(); $('body').append(cpy_input); }
To remove a input, put a 'x' element and .bind('click', function rmv_input());
function rmv_input(){ var $parent = $(this).closest(); $parent.find('[type="text"]').remove(); }
If you want a little example, send me a e-mail: leo.mauro.desenv@gmail.com
| Recommend package | |
|
|