怎样用jquery得到文本框的值
用jquery怎么得值 展开
完整的页面代码如下:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="../res/js/jquery-1.11.1.min.js"></script>
<script>
/*页面加载时,给按钮绑定单击事件*/
$(function () {
$("input[type='button']").click(function () {
/*循环获取文本框的值*/
$("input[type='text']").each(function () {
$("span").append($(this).val() + ",");
});
});
});
</script>
<title>jquery获取所有文本框的值</title>
</head>
<body>
文本框1:<input type="text" id="text1" /><br />
<br />
文本框2:<input type="text" id="text2" /><br />
<br />
文本框3:<input type="text" id="text3" /><br />
<br />
文本框4:<input type="text" id="text4" /><br />
<br />
文本框5:<input type="text" id="text5" />
<input type="button" id="btnsee" value=" 查看 " /><br />
<br />
<span></span>
</body>
</html>
广告 您可能关注的内容 |