Last active
March 23, 2020 15:41
-
-
Save vfontjr/c94b1d513b748569d7fc7b424a0b996c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
jQuery(document).ready(function($) { | |
"use strict"; | |
$('input[name="item_meta[185][]"]').on('change', function() { | |
var selected_div_class = '', | |
remove_div_class = ''; | |
$('input[name="item_meta[185][]"]').each( function() { | |
if ( $(this).prop("checked") ) { | |
/* apply the highlight class to the selected option's parent div */ | |
selected_div_class = $(this).prop('class') + '-highlight'; | |
$(this).closest('div').addClass(selected_div_class); | |
} else { | |
/* remove highlights from any other options' parent div */ | |
remove_div_class = $(this).prop('class') + '-highlight'; | |
if ( $(this).closest('div').hasClass(remove_div_class) ) { | |
$(this).closest('div').removeClass(remove_div_class); | |
} | |
} | |
}); | |
}); | |
}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#frm_form_17_container div.highlight { | |
border: 1px solid #187374; | |
background-color: rgb(255,255,235); | |
} | |
#frm_form_17_container div.highlight label { | |
color: red; | |
font-weight: bold; | |
} | |
#frm_form_17_container div.red-highlight { | |
border: 3px double #000; | |
border-radius: 7px; | |
background-color: red; | |
padding: 0 1rem; | |
} | |
#frm_form_17_container div.red-highlight label { | |
color: white; | |
font-weight: bold; | |
} | |
#frm_form_17_container div.green-highlight { | |
border: 3px double #000; | |
border-radius: 7px; | |
background-color: green; | |
padding: 0 1rem; | |
} | |
#frm_form_17_container div.green-highlight label { | |
color: yellow; | |
font-weight: bold; | |
} | |
#frm_form_17_container div.blue-highlight { | |
border: 3px double #000; | |
border-radius: 7px; | |
background-color: blue; | |
padding: 0 1rem; | |
} | |
#frm_form_17_container div.blue-highlight label { | |
color: cyan; | |
font-weight: bold; | |
} | |
#frm_form_17_container div.yellow-highlight { | |
border: 3px double #000; | |
border-radius: 7px; | |
background-color: yellow; | |
padding: 0 1rem; | |
} | |
#frm_form_17_container div.yellow-highlight label { | |
color: green; | |
font-weight: bold; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="frm_field_[id]_container" class="frm_form_field form-field [required_class][error_class]"> | |
<div id="field_[key]_label" class="frm_primary_label">[field_name] | |
<span class="frm_required">[required_label]</span> | |
</div> | |
<div class="frm_opt_container" aria-labelledby="field_[key]_label" role="group">[input opt=1 class="red"][input opt=2 class="green"][input opt=3 class="blue"][input opt=4 class="yellow"]</div> | |
[if description]<div class="frm_description" id="frm_desc_field_[key]">[description]</div>[/if description] | |
[if error]<div class="frm_error" id="frm_error_field_[key]">[error]</div>[/if error] | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
jQuery(document).ready(function($) { | |
"use strict"; | |
$('input[name="item_meta[184][]"]').on('change', function() { | |
/* first remove highlights from any other options' parent div */ | |
$('input[name="item_meta[184][]"]').each( function() { | |
if ( $(this).prop("checked") ) { | |
/* apply the highlight class to the selected option's parent div */ | |
$(this).closest('div').addClass('highlight'); | |
} else { | |
if ( $(this).closest('div').hasClass('highlight') ) { | |
$(this).closest('div').removeClass('highlight'); | |
} | |
} | |
}); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment