jQuery > Traversing methods

.children() - Get all children elements in jQuery

How to get all the children elements of a parent element in jQuery?


To get all the children element of an parent element, children() method can be used.

 <script>
      $("div").children().css("background", "red");
  </script>

Above code snippet will get all the children element of all the div element of the page and apply css style background color to red.

 Views: 19961 | Post Order: 40



Write for us






Hosting Recommendations