Is it possible to replace a div element with jquery and update the dom?
Posted
by Scarface
on Stack Overflow
See other posts from Stack Overflow
or by Scarface
Published on 2010-04-19T03:44:43Z
Indexed on
2010/04/19
3:53 UTC
Read the original article
Hit count: 187
jQuery
Hey guys quick question, I want to update the contents of a div with two new divs to take the place of the previous ones. Each new div has a unique id to take the place of the old ones. I then want any further update to use the ids of the new divs as their values instead of the original. Is this possible in Jquery? Thanks in advance for any assistance.
var display_total=$(".display_total").attr("id");
var display_of_total=$(".display_of_total").attr("id");
var new_display_of_total=parseInt(display_of_total)+1;
var new_display_total=parseInt(display_total)+1;
$('.totalmessages').html('<div class="display_of_total" id="'+new_display_of_total+'">Displaying '+new_display_of_total+' of </div><div class="display_total" id="'+new_display_total+'">'+new_display_total+' messages...</div>');
© Stack Overflow or respective owner