3 Star 54 Fork 14

Yaohaixiao / dom.js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
getValue.js 577 Bytes
一键复制 编辑 原始数据 按行查看 历史
import isElement from './isElement'
import getAttribute from './getAttribute'
import { FROM_ELEMENT_TAGS } from './utils/enum'
/**
* 获取 DOM (表单)元素的 value 属性值
* ========================================================================
* @method getValue
* @since 0.5.0
* @param {HTMLElement} el
* @return {String}
*/
const getValue = (el) => {
if (
!isElement(el) ||
FROM_ELEMENT_TAGS.indexOf(el.tagName.toLowerCase()) === -1
) {
return ''
}
return getAttribute(el, 'value')
}
export default getValue
JavaScript
1
https://gitee.com/yaohaixiao/dom.js.git
git@gitee.com:yaohaixiao/dom.js.git
yaohaixiao
dom.js
dom.js
main

搜索帮助