jQuery > Attribute related method

.appendTo() - append source element to target in jQuery

How to append the source element content to the target in jQuery?


To append the source html content at the end of the target html content, appendTo() method can be used.

<script>
      $("p").appendTo("#div3");
  </script>

Above code snippet will append all paragraphs element (“p”) content to the element whose id is “div3” (consider “p” as source and “div3” as target element).

 Views: 4952 | Post Order: 31



Write for us






Hosting Recommendations