jquery中的val()示例应用代码如下:
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "https://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>jquery中的val()</title>
<script type="text/javascript" src="jquery-2.1.0.js"></script>
<script type="text/javascript">
$(function(){
$("#btn").click(function(){
$("input[name=ckb]:checked").each(function() {
alert($(this).val());
});
});
});
</script>
</head>
<body>
<p id="p1">
<table>
<tr>
<td>
<input type="checkbox" id="ckb1" name="ckb" value="篮球"/>篮球
<input type="checkbox" id="ckb2" name="ckb" value="足球"/>足球
<input type="checkbox" id="ckb3" name="ckb" value="排球"/>排球
</td>
</tr>
<tr>
<td>
<input type="button" id="btn" value="取值"/>
</td>
</tr>
</table>
</p>
</body>
</html>
如对本文有疑问, 点击进行留言回复!!
asp.net中ajax和一般处理程序(handler.ashx)的交互
egg.js创建项目,目录介绍,简单使用,sequelize mysql使用
网友评论