0

I have a text box with add more button

<div class="input-group control-group after-add-more">
          <input type="text" name="column[]" class="form-control" placeholder="Enter Column name here">
          <div class="input-group-btn"> 
            <button class="btn btn-success add-more" onclick="addMore()" type="button"><i class="glyphicon glyphicon-plus"></i></button>
          </div>
        </div>
          <input type="hidden" name="projectid" class="form-control" value="'.$_REQUEST['project_id'].'">
        </form>

        <!-- Copy Fields -->
        <div class="copy hide">
          <div class="control-group input-group" style="margin-top:10px">
            <input type="text" name="column[]" class="form-control" placeholder="Enter Column name here">
            <div class="input-group-btn"> 
              <button class="btn btn-danger remove" type="button"><i class="glyphicon glyphicon-asterisk"></i></button>
            </div>
          </div>
        </div>

    </div>
  </div>
</div>

and jQuery:

function addMore()
{
    var html = $(".copy").html();
          $(".after-add-more").after(html);
}

which is working but issue is that always an empty column in the end of add more.eg:

[column] => Array
        (
            [0] => zzzzzzz
            [1] => 
        ) 

Here i have only one value,but an empty column in the end of array.Please help me.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

0 Answers0