get element value using jquery

旧时模样 提交于 2019-11-27 08:48:30

问题


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>

回答1:


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

$(".EventAddress").text();



回答2:


alert($('.EventAddress').html());

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



来源:https://stackoverflow.com/questions/8555064/get-element-value-using-jquery

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!