Difference between val() and text()
2015-10-14 16:47
309 查看
.val()works on input elements (or any element with a value attribute?) and
.text()will not work on input elements.
.val()gets the value of the input element -- regardless of type.
.text()gets the innerText (not HTML) of all the matched elements:
.text()
The result is a string that contains the combined text contents of all matched elements. This method works on both HTML and XML documents. Cannot be used on input elements. For input field text use the val attribute.
.val()
Get the content of the value attribute of the first matched element
相关文章推荐
- node.js was not found in the default path
- ExtJs 实现动态列,动态多表头
- <LeetCode><Easy>237Delete Node in a Linked List ****
- JQuery插件DataTables使用的错误
- ExtJs Grid自动生成列
- 前端开发工具集-----项目开发AngularJS篇
- AngularJS 表单验证
- JavaScript中list的简单使用<菜单>
- css制作简单下拉菜单
- jQuery笔记
- CSS后代选择器
- 关于H5填写信息类页面横向布局总结
- 基本CSS选择器,复合选择器,后代选择器
- 第一个练手项目(纪念)
- 60款很酷的 jQuery 幻灯片演示和下载
- html5 定位
- jQuery MiniUI开发系列之:使用API文档
- a标签中关于javascript:void(0)的几个问题
- 导出Excel 或 大量耗时计算时,前端界面保持可操作
- JS中window.document对象