KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to output the number of options in a select drop down, but there are multiple ones on the same page. For example: <select name="select" class="drop"> <option name="option" value="Option 1"></option> </select> <select name="select" class="drop"> <option name="option" value="Option 1"></option> <option name="option" value="Option 2"></option> <option name="option" value="Option 3"></option> </select> So the first one would output (1) and the second would output (3). I have this code but it outputs (4) - counting all options from all selects. <script type="text/javascript"> $(function() { $(".date_number").text($(".drop option").length + " items"); }); </script> Any help appreciated!
Tags (comma-separated)
Save Edits
Cancel