I'm having issues with keyboard binding when cloning an item. Here's the script:
I have html markup like this:
<tr class="rijbasis">
<td>
<input type="text" class="count" />
</td>
<td>
<span class="cost">10</span>
</td>
<td>
<span class="total">10</span>
</td>
</tr>
I bind the keyup function to the input element of my table row as follows:
$('.rijbasis input').keyup(function(){
var parent = $(this).parent().parent();
$('.total',parent).text(parseInt($('.cost',parent).text()) * parseInt($('.count',parent).val()));
}
I developed a function so that I could clone a table row in an onclick event and add it to the body:
$('.lineadd').click(function(){
$('.contract tbody').append($('.contract tbody tr:last').clone());
$('.contract tbody tr:last input').val("0");
});
This works, but the keyup function does not work with the input elements of the cloned string.
Can someone help or advise? I hope I was clear enough and I will definitely add details if necessary to solve this problem.
Hi
source
share