From 2dbcce16ae60ccd2344ffc1b35e3afa5816dd756 Mon Sep 17 00:00:00 2001 From: Halil Bilir Date: Sun, 13 Jan 2013 00:18:15 +0200 Subject: [PATCH] do not check label if the input is disabled --- css/prettyCheckboxes.css | 3 ++- index.html | 4 ++-- js/prettyCheckboxes.js | 5 +++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/css/prettyCheckboxes.css b/css/prettyCheckboxes.css index 15c9cf6..a7c318f 100644 --- a/css/prettyCheckboxes.css +++ b/css/prettyCheckboxes.css @@ -19,7 +19,8 @@ label.checked span.holder, label.checked:hover span.holder, label.checked:hover span.holder { top: -42px !important; } /* Background position when checked */ - + + .disabled { opacity: 0.5; filter: alpha(opacity=50); zoom: 1; } /* ------------------------------------------------------------------------ Customize at your own risk diff --git a/index.html b/index.html index 8d31a2d..19f6f2e 100644 --- a/index.html +++ b/index.html @@ -31,9 +31,9 @@ - + - + diff --git a/js/prettyCheckboxes.js b/js/prettyCheckboxes.js index de5a3db..eefb285 100644 --- a/js/prettyCheckboxes.js +++ b/js/prettyCheckboxes.js @@ -39,6 +39,11 @@ // Associate the click event $label.bind('click',function(){ + // Do not check label if the input is disabled + if($('input#' + $(this).attr('for')).is(':disabled')){ + return false; + } + $('input#' + $(this).attr('for')).triggerHandler('click'); if($('input#' + $(this).attr('for')).is(':checkbox')){