javascript - Give element id numbers then insert one at end -
i have changing number of divs , need specific div go @ end.... i'd somehow count number of divs using javascript or jquery, , insert specific div @ end... example
<div class="message" id="1"> <div class="message" id="2">.... <div class="message" id="88">
then need final div number , add 1 gets inserted @ end
<div class="message" id="89">
how accomplished?
var lastid = $('div.message').last().attr('id'); $('div.message').last().parent().append('<div class="message" id="' + lastid + 1 + '">');
Comments
Post a Comment