Home >Web Front-end >JS Tutorial >Introduction to the usage of append() and appendTo() for node insertion_jquery

Introduction to the usage of append() and appendTo() for node insertion_jquery

WBOY
WBOYOriginal
2016-05-16 17:04:001310browse
Copy code The code is as follows:





jquery






  • Good

  • Very good
  • Very good

  • Exceptionally good

  • It's so good

  • It's so good that it can't be described





Operation on existing nodes
Copy code The code is as follows:





jquery4

< script type="text/javascript">
$(function(){
var li1 = $("
  • hello
  • ");
    var li2 = $("
  • world
  • ");
    var li3 = $("
  • hello world
  • ") ;
    $("ul").append(li1);
    $("ul").prepend(li2);
    $("ul li:eq(4)").after(li3 );

    });



    What do you think Is the training at San Si Park good?



    • Good

    • Very good
    • Very good

    • Exceptionally good

    • It's so good

    • It's so good that it can't be described



    Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn