<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>checkbox樣式</title> </head> <style> .remberpass input, .remberpass span { float: left; } /* 將瀏覽器默認的checkbox樣式重置 */ input[type=checkbox] { -webkit-appearance: none; width: 15px; height: 15px; background-color: white; border: 1px solid #5692fc; border-radius: 3px; } input[type=checkbox]:checked { background: red;/*可加背景圖片*/ background-repeat: no-repeat; } </style> <body> <div class="remberpass"> <input class="test" type="checkbox" /> <span>記住密碼</span> </div> </body> </html> <script src="https://cdn.bootcss.com/jquery/1.12.3/jquery.min.js"></script> <script> $(".test").click(function(){ if($("input[type='checkbox']").prop('checked')){ alert("選中"); }else{ alert("未選中") } }) </script>