Re: 請問有關jquery抓checkbox的問題?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="" rel="nofollow">http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Checkbox Test</title>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">//<![CDATA[
google.load('jquery', '1.2.6');
//]]></script>
</head>
<body>
<form>
<input type="checkbox" id="FCHK" name="F_CHK[]" value="AA" />
<input type="checkbox" id="FCHK1" name="F_CHK[]" value="BB" />
<input type="checkbox" id="FCHK2" name="F_CHK2[]" value="CC" />
<input type="checkbox" id="FCHK3" name="F_CHK2[]" value="DD" />
</form>
<script type="text/javascript">
(function($){
var chk1 = '';
var which = '';
$("input[@name='F_CHK[]']").each(function(){
chk1 += $(this).val() + ', ';
if ( $(this).attr('checked') ){
which = $(this).attr('id');
}
});
alert('走訪F_CHK[]' + chk);
alert(which + '被勾選');
})(jQuery);
</script>
</body>
</html>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.117.202.109
→
07/10 19:40, , 1F
07/10 19:40, 1F
→
07/10 19:40, , 2F
07/10 19:40, 2F
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章
40
171