怎样用jquery得到文本框的值

如<inputtype="text"name="one"value="5"/>用jquery怎么得值... 如 <input type="text" name="one" value="5"/>

用jquery怎么得值
展开
 我来答
hkyz257200
高粉答主

2018-05-31 · 醉心答题,欢迎关注
知道小有建树答主
回答量:205
采纳率:75%
帮助的人:5.4万
展开全部

完整的页面代码如下:

<!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>

已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式