javascript - How to count no.of Div Elements by jquery -
i have find number of div elements nowadays in .inner class , find index of element
<div class="inner"> <div class="movable" id="one"> <div>one</div> <div>two</div> <div>three</div> </div> <div class="movable" id="two"> <div>one</div> <div>two</div> <div>three</div> </div> <div class="movable" id="three"> <div>one</div> <div>two</div> <div>three</div> </div> </div>
try
$(".inner").children().length; // direct kid
or
$(".inner div").length; // deep kid $(".inner").find("div").length; // deep kid $(".inner > div").length // direct kid
javascript jquery
No comments:
Post a Comment