javascript - Does JQuery have a "move" function? Or is there a more compact way of doing this? -
when using jquery in conjunction content management system, find myself writing snippets of code such
$(document).ready(function() { var thishtml = $('#some-element')[0].outerhtml; $('#some-element').remove(); $('#hmpg-btm-box-holder').prepend(thishtml); });
does jquery have functionality accomplish in more compact fashion?
this should suffice:
$(document).ready(function() { $('#hmpg-btm-box-holder').prepend($('#some-element')); });
i'd avoid using outerhtml
whenever possible (and preferably innerhtml
also, unless e.g. receive html trusted server via ajax , want include in document).
converting element element
string (html) representation , element
can cause unwanted effects removing event handlers attached it.
Comments
Post a Comment