0

How do I get the value of the cell with class EventAddress using jquery?

<table cellpadding="10" class ="EventDetail">
    <tr>
        <td class="TableFields">Who Should Enroll?:</td>
        <td>Everyone 18 and older who would like to attend</td>
    </tr>
    <tr>
        <td class="TableFields">Location:</td>
        <td class="EventAddress">1300 Albany Street,Beech Grove ,IN</td>
    </tr>
</table>

2 Answers 2

2

If you with "value" mean the content of the td-element, then you could do:

$(".EventAddress").text();
Sign up to request clarification or add additional context in comments.

3 Comments

You know... You can tip up the answer that you like for approve it as the valid one...
@AJSwift Nope. Val only works on textarea, input and select elements. For getting text is valid .text(); and .html();
@AJSwift No, .val() would not work, since it return the content of the value-attribute of an input element. Here's the documentation about .val(): api.jquery.com/val
1
alert($('.EventAddress').html());

Basic example: http://jsfiddle.net/LMBsc/

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.