Hello
I wanted to get a count of all the LIs until <li id="end">Test </li>
So the alert should prompt 7 instead of 12. I am trying the following code but does not seem to work. The code is prompting me 1. Can you pls help me?
ThanksCode:<script src="jquery.js"></script> <script> $(document).ready(function(){ var xx = $('ul li#end').length; alert(xx); }); </script> <ul> <li>Test </li> <li>Test </li> <li>Test </li> <li>Test </li> <li>Test </li> <li>Test </li> <li id="end">Test </li> <li>Test </li> <li>Test </li> <li>Test </li> <li>Test </li> <li>Test </li> </ul>



Reply With Quote



Bookmarks