samedi 25 novembre 2017

Javascript add / remove textbox

I have the below javascript and I cannot take the values from the textbox that code generates to the html

("#btnAdd").bind("click", function () {
var div = $("<tr />");
div.html(GetDynamicTextBox(""));
$("#TextBoxContainer").append(div);
});

$("body").on("click", ".remove", function () {
$(this).closest("tr").remove();
});
});
function GetDynamicTextBox(value) {


return '<td><textarea name = "prodcut_name"  type="text" value = " ' + value + '" class="form-control" /></td>'   + '" /></td>'+ '<td><textarea name = "product_directions" type="text" value = "' + value + '" class="form-control" /></td>' + '<td><button type="button" class="btn btn-danger remove">X</button></td>'

my html form that I need to take the values

 <form action="" method="post">
<h5 class="text-center">Product</h5>
        <section class="container">
        <div class="table table-responsive">
        <table class="table table-responsive table-striped table-bordered">
        <thead>
          <tr>
              <td>Product Name</td>
              <td>Details</td>
              <td>Remove</td>
            </tr>
        </thead>
        <tbody id="TextBoxContainer"  >
        </tbody>
        <tfoot>
          <tr>
            <th colspan="5">
            <button id="btnAdd" type="button" class="btn btn-primary" data-toggle="tooltip" data-original-title="Add more controls"></i>+ Add </button></th>
          </tr>
        </tfoot>
        </table>
        </div>
        </section>



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2BbgXhS
via IFTTT

Aucun commentaire:

Enregistrer un commentaire