Javascript examples for jQuery Method and Property:size
The size() method was deprecated in version 1.8 and removed in jQuery version 3.0. Use the length property instead.
The size() method returns the number of elements matched by the jQuery selector.
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ console.log($("li").size()); });//w ww .j a v a 2 s .c om }); </script> </head> <body> <button>test</button> <ul> <li>A</li> <li>B</li> <li>C</li> </ul> </body> </html>