Jquery删除表单标记,而不是内容

你好我需要删除一个表单标签,但不是内容:

not remove this only the form tag

 $form = $('#form'); $form.replaceWith($form.html()); 

应该做你需要的。

为你的div添加一个id或类

例如

 
not remove this only the form tag

然后

 $(".wrapper").unwrap(); 

从DOM中删除表单标记时,其所有子元素都正确。 实现所要求的唯一方法是拉出所有表单标记的直接子节点,并将它们附加到DOM中的其他节点,以防止它们从页面中消失

如果您有许多需要修改的元素:

 $('.element').replaceWith(function() { return $(this).html(); }); 

jsFiddle: http : //jsfiddle.net/calvintennant/mdrHb/

如果它是xml(由dotNet生成的页面),只需删除表单节点