Can anyone guide me to delete the first div, when there are 5 div's
I'm cloning a text box, users can add multiple textbox's but when it reaches to 5, i should automatically delete the first textbox and add another at the end of the node
Thanks
Can anyone guide me to delete the first div, when there are 5 div's
I'm cloning a text box, users can add multiple textbox's but when it reaches to 5, i should automatically delete the first textbox and add another at the end of the node
Thanks
With jQuery:
You need to count all of these divs and remove first one:
count = $('#container div').length;
if (count > 5) {
$('#container div:first').remove();
}
To add new div:
$('#container').append('<div ...><textbox...></textbox></div>');