Jquery val方法获取对象value和length属性
2017-10-08 本文已影响35人
报告老师
<input type=“text” id=“text” value=“1234asd” />
console.log($(“#text”).val());
输出:1234asd
console.log($(“#text”).val().length);
输出:7
<input type=“text” id=“text” value=“1234asd” />
console.log($(“#text”).val());
输出:1234asd
console.log($(“#text”).val().length);
输出:7