I have this code
$(document).ready(function(){
$('.selector').click(function(){
obj = $(this);
obj.replaceWith('<div class="size">whats up man ??!</div>');
alert(obj.html());
});
});
I want to get the new content of 'obj' that has been 'replaceWith'
but,
I get the old content instead ...
how do I get the actual content of 'obj' ???
my intention is to access the new 'obj'
$('.selector').click(function(){
var obj = $(this),
repl = $('<div class="size">whats up man ??! <span class="medium"></span></div>');
obj.replaceWith(repl);
alert(obj.find('span').attr('class')); //this will print 'undefined'
});
I want to print the class name of the 'span' which is 'medium'