
Using jQuery to remove a second form element without losing the child elements
By: a guest on
Feb 26th, 2012 | syntax:
None | size: 0.62 KB | hits: 27 | expires: Never
// Captures the children
var children = $("form:eq(1)").children();
// Removes the form
$("form:eq(1)").remove();
// append the child elements back into the DOM
$("#fillDiv").append(children);
// grab the child nodes
var children = $('#badForm').children();
// or var children = $('#badForm > *');
// move them to the body
$(body).append(children);
// remove the form
$('#badForm').remove();
$.ajax({
type: "get",
url: "url",
data: ,
cache: false,
success: function(data){
}
});
$(data).find('#whatYouNeed').appendTo('#whereYouNeed')