使用jQuery获取div内容的值 [英] Get value of div content using jquery

查看:105
本文介绍了使用jQuery获取div内容的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下html,我想获取div的值为其他" 我该如何使用jQuery?

I have the following html and I want to get the value of the div which is "Other" How can I do this with jQuery?

 <div class="readonly_label" id="field-function_purpose">
        Other
 </div>

推荐答案

使用 .text()提取内容div

var text = $('#field-function_purpose').text()

这篇关于使用jQuery获取div内容的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆