PHP Classes

Dynamically add and remove textbox: Dynamically add and remove textbox functionality using jQuery

Recommend this page to a friend!
  All requests RSS feed  >  Dynamically add and remove textbox  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

Dynamically add and remove textbox

A request is featured when there is no good recommended package on the site when it is posted. Edit

Picture of sushma by sushma - 7 years ago (2016-06-16)

Dynamically add and remove textbox functionality using jQuery

This request is clear and relevant.
This request is not clear or is not relevant.

+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 Clarification requests
  • 3. Picture of Christian Vigh by Christian Vigh - 7 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. Picture of Manuel Lemos by Manuel Lemos - 7 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. Picture of Leonardo Mauro Pereira Moraes by Leonardo Mauro Pereira Moraes - 7 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

        Ask clarification

        Recommend package
        : 
        :