Cut And Paste Html To Other Element
I need cut and paste text with all tags inside from main span to label element in every p tag.
Solution 1:
You need to use the children method instead of the find method. The .children() method differs from .find() in that .children() only travels a single level down the DOM tree while .find() can traverse down multiple levels to select descendant elements (grandchildren, etc.) as well. (see https://api.jquery.com/children/)
$(document).find('form p').each(function((){
$(this).children('span').appendTo($(this).children('label'))
});
Post a Comment for "Cut And Paste Html To Other Element"