Modify ↓
Ticket #3979 (closed bug: worksforme)
jQuery('.class') returns only one element
| Reported by: | enerta | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.3.2 |
| Component: | unfiled | Version: | 1.3.1 |
| Keywords: | select element by class, $('.class') | Cc: | |
| Blocking: | Blocked by: |
Description
v 1.3.1 seems to find the first element of a certain class only.
E.g. $('.edit').click(function(){alert('I am .edit. My title is ' + $(this).attr('title'))});
would work on the first of three images but not the rest of them in this case:
<ul> <li><img src="image.gif" title="1" class="edit" /></li> <li><img src="image.gif" title="2" class="edit" /></li> <li><img src="image.gif" title="3" class="edit" /></li> </ul>
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

This works for me:
http://jquery.nodnod.net/cases/48