get element value using jquery

2020-02-07 10:00发布

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条回答
做自己的国王
2楼-- · 2020-02-07 10:23

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

$(".EventAddress").text();
查看更多
我想做一个坏孩纸
3楼-- · 2020-02-07 10:26
alert($('.EventAddress').html());

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

查看更多
登录 后发表回答