3

Consider the following, how do get the last element of a particular data attribute value?

      <tr data-log="sectionA"><td>Log Information</td></tr>
      <tr data-log="sectionA"><td>Log Information</td></tr>
      <tr data-log="sectionA"><td>Log Information</td></tr>
      <tr data-log="sectionA"><td>Log Information</td></tr> <--- I need this last element of sectionA
      <tr data-log="sectionB"><td>Log Information</td></tr>
      <tr data-log="sectionB"><td>Log Information</td></tr>
      <tr data-log="sectionB"><td>Log Information</td></tr>
      <tr data-log="sectionB"><td>Log Information</td></tr>

I'm not sure what to try.. thanks for any ideas...

1 Answer 1

3

How about

$('[data-log="sectionA"]:last')

http://jsfiddle.net/U9HQH/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.