监听checkbox事件


<!DOCTYPE html> <html> <head> <title></title> </head> <script> function onClickHander(obj){ if(obj.checked){ console.log("selected"); }else{ console.log("unselected"); } } </script> <body> <input id="checkBox" type="checkbox" onclick="onClickHander(this)"></input> </body> </html>

  

猜你喜欢

转载自www.cnblogs.com/amber-liu/p/9942784.html