Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion css/prettyCheckboxes.css
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
<label for="checkbox-3" tabindex="3">Item 3</label>
<input type="checkbox" name="checkbox-3[braket]" id="checkbox-3" value="checkbox-3" />

<label for="checkbox-4" tabindex="4">Item 4</label>
<label for="checkbox-4" class="disabled" tabindex="4">Disabled Item</label>

<input type="checkbox" name="checkbox-4[braket]" id="checkbox-4" value="checkbox-4" />
<input type="checkbox" name="checkbox-4[braket]" id="checkbox-4" disabled="disabled" value="checkbox-4" />

<label for="checkbox-5" tabindex="5">Check all</label>
<input type="checkbox" name="checkbox-5[braket]" id="checkbox-5" value="checkbox-5" onclick="checkAllPrettyCheckboxes(this,$('#checkboxDemo'))" />
Expand Down
5 changes: 5 additions & 0 deletions js/prettyCheckboxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')){
Expand Down