Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *
- * this script runs in wordpress admin area
- */
- jQuery(document).ready(function(){
- if(jQuery('#locations-servicechecklist li label input:checked').length >= 2){
- jQuery('#locations-servicechecklist li label input[type="checkbox"]:not(:checked)').attr('disabled', 'disabled');
- jQuery('#locations-servicechecklist li label input[type="checkbox"]:not(:checked)').closest('label').css("color", "#c5c5c5");
- }
- jQuery('#locations-servicechecklist li label input[type="checkbox"]').click(function(event) {
- var checked_name = jQuery(this).closest('label').clone().children().remove().end().text().trim();
- jQuery('#core-servicechecklist li label input[type="checkbox"]:checked').each(function(){
- if(this.checked && checked_name == jQuery(this).closest('label').clone().children().remove().end().text().trim()){
- event.preventDefault();
- alert('You canncot select same name service from other service types!');
- }
- });
- jQuery('#aspirational-servicechecklist li label input[type="checkbox"]:checked').each(function(){
- if(this.checked && checked_name == jQuery(this).closest('label').clone().children().remove().end().text().trim()){
- event.preventDefault();
- alert('You canncot select same name service from other service types!');
- }
- });
- });
- jQuery('#locations-servicechecklist li label input[type="checkbox"]').change(function(event) {
- if(jQuery('#locations-servicechecklist li label input:checked').length < 2){
- jQuery('#locations-servicechecklist li label input[type="checkbox"]:not(:checked)').removeAttr('disabled');
- jQuery('#locations-servicechecklist li label input[type="checkbox"]:not(:checked)').closest('label').css("color", "");
- }
- if(jQuery('#locations-servicechecklist li label input:checked').length == 2){
- jQuery('#locations-servicechecklist li label input[type="checkbox"]:not(:checked)').attr('disabled', 'disabled');
- jQuery('#locations-servicechecklist li label input[type="checkbox"]:not(:checked)').closest('label').css("color", "#c5c5c5");
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement