I want to replace the code with new code. I used replaceWith to replace the function.But it removes the new class from where it was before . I want that class to stay in where ever it was before and need to replace the another class. How to do it?? Ex: $('.popinner').insertAfter($('.rContentPopUp')开发者_开发问答); when I do this".rContentPopUp" is replacing the 'popinner' class. BUt ".rContentPopUp" was removed from old structure where ever it was there.
In jQuery you can pass a class name to the removeClass function eg...
$('#element name').removeClass('classToRemove');
doing this will just remove that class from the element leaving all existing classes. Then you can simply call addClass to add in your new class. I believe this is what you want to do?
精彩评论