I tried:
but it didn
$("<!--your comment text here -->").insertAfter(selector);
or
$(selector).after("<!--your comment text here -->");
live demo
Some options:
$('.mycurrentclass').remove();
$('.mycurrentclass').detach();// see below for possible use
$('.mycurrentclass').css({display:'none'});
$('.mycurrentclass').hide();
$('.mycurrentclass').toggleClass('myhiddenclass');
$('.mycurrentclass').addClass("myhiddenclass");
$("myselector").toggle(
function () {
$(this).addClass("myhiddenclass");
},
function () {
$(this).removeClass("myhiddenclass");
}
);
// programtic like you seem to want:(first part puts it back, else detaches it)
var p;
if ( p )
{
p.appendTo("mywheretoappenditselector");
p = null;
}
else
{
p = $("myselector").detach();
};
I think you would need prepend and append to do it the way you are thinking. Not sure if it would actually make things disappear though.
If you want something to not be visible, your best bet would be to use hide().