3
I wanted to make it work with js(jQuery) the interface below:
I am using the CSS Foundation framework to develop this project. However, I don’t know how to make a clone using the jQuery of this combo where the inputs are. In fact I want that the moment the user clicks on more it dynamically add one more line equal to the first to enter more records.
The HTML of this record is below:
<form action="">
<div class="row box_pergunta">
<div class="large-8 columns">
<label>Mensagem:</label>
<input name="pergunta" type="text">
</div>
<div class="large-2 columns">
<label>Ordem</label>
<select name="">
<option value="antes">Antes</option>
<option value="depois">Depois</option>
</select>
</div>
<div class="large-2 columns">
<input type="button" class="button tiny success btn_remove" value="Remover" style="margin: 1.375rem 0 0 1.5625rem; ">
</div>
</div>
</form>
I’m already using jQuery in the project.
How do I make the green button (remove) to work? In case, remove the line on which it is clicked.
– Luitame
@Luitame edited the answer by adding the remove function.
– abfurlan
on the JS to remove the box it only works in the first box of the list. In the ones that are cloned the script does not work. What I can do?
– Luitame
@Luitame you added the
true
as a parameter inclone(true)
?– abfurlan
Everything works normal friend just don’t remove button
– Luitame
@Luitame see in the http://jsfiddle.net/abfurlan/jpgcLdog/3 example that is working, but if you remove the
true
of functionclone()
, remove button does not work on cloned elements, parametertrue
causes event handlers to be cloned as well– abfurlan
This true that you refer to is in JS? Where is it? I took a look but do not identify it.
– Luitame
@Luitame Yes, it’s in JS
$clone = $('.box_pergunta.hide').clone(true);
– abfurlan
Now after I reset the True is working beautifully. Thank you @abfurlan
– Luitame