1. 程式人生 > >jquery判斷checkbox是否被選中

jquery判斷checkbox是否被選中

fun utf-8 htm body meta inpu alert -c his

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>無標題文檔</title>
<script src="jquery-3.2.1.min.js"></script>
<script>
$(function(){
    $("input[type=checkbox]").change(function(e) {
        //alert(this.checked);
        if(this.checked)
        {
            alert(
我被選中了); }else { alert(我沒被選中); } }); }); </script> </head> <body> <input type="checkbox" /> </body> </html>

jquery判斷checkbox是否被選中