Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   Отчистить между тегами (https://javascript.ru/forum/jquery/27553-otchistit-mezhdu-tegami.html)

nonamez 16.04.2012 21:29

Отчистить между тегами
 
В общем как отчистить/удалить всё, что между тегами </form></body>

atlantis 16.04.2012 22:24

$('form').empty();
$('body').empty();

Pavel M. 16.04.2012 22:41

может это нужно?
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>test</title>
  <script>
    function clr() {
      var form = document.getElementsByTagName('form')[0],
          formParent = form.parentNode,
          el;
      while(el = form.nextSibling) {
        formParent.removeChild(el);
      }
    }
  </script>
</head>
<body>
    
  <form>
    <input type="text">
    <button type="button" onclick="clr();">Очистить все после form</button>
  </form>
    
  <p>xxxxx</p>
  yyyyyy
    
</body>
</html>​


Часовой пояс GMT +3, время: 05:12.