replacewith

Multiple replaceWiths in jQuery?

Why doesn't this work? What would be a plausible solution to get this effect? $(document).ready(function() { $('#myLink1').click( function() { $('#myLink1').replaceWith('<a id="myLink2" href="#panel2">#panel2</a>'); }); $('#myLink2').click( function() { $('#myLink2').replaceWith('<a id="myLink3" href="#pa...

how to get actual content of an object after being replaceWith('something') in jquery

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...

Change the tag but keep the attributes and content -- jQuery/Javascript

Hello! How can you get: <a href="page.html" class="class1 class2" id="thisid">Text</a> changed to <p href="page.html" class="class1 class2" id="thisid">Text</p> I'm familiar with jQuery's replaceWith but that doesn't keep attributes/content as far as I know. Note: Why would p have a href? Cuz I need to change p back to a on a...

How To I Replace New Elements Added To A Page With Jquery

Here is the scenario... I have a a checkbox next to each field that I am replacing on page load with jquery with "Delete" text that enables me to delete the field via jquery, which is working fine. Like so... $(".profile-status-box").each(function(){ $(this).replaceWith('<span class="delete">' + 'Delete' + '</span>') }); The problem...