Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Automatic hide and select variation for mug */
- $('#attribute183 option[value="50"]').attr('selected', 'selected');
- $("#attribute183").removeClass('required-entry').css("display", "none");
- /* On change function to show and hide variations in chosse item */
- $("#attribute182").on('change', function(event) {
- /* Items to show variation */
- var arr = ["camiseta", "blusinha"];
- /* Get item selected to compare with arr */
- var info = $("#attribute182 option:selected").data("label");
- /* if info in arr */
- if($.inArray(info, arr) != -1){
- /* Disable mug variation */
- $('#attribute183 option[value="50"]').removeAttr('selected').attr("disabled", "disabled");
- /* Force required to variations */
- $("#attribute183").addClass('required-entry').css("display", "block");
- } else {
- /* Enable mug variation and auto-select */
- $('#attribute183 option[value="50"]').removeAttr("disabled").attr('selected', 'selected');
- /* Remove force required to variations */
- $("#attribute183").removeClass('required-entry').css("display", "none");
- }
- /* If on change action in first select, remove disabled in all options */
- $("#attribute182 option, #attribute183 option").each(function() {
- $(this).removeAttr('disabled');
- });
- });
- /* If on change action in second select, remove disabled in all options */
- $("#attribute183").on('change', function(event) {
- $("#attribute182 option").each(function() {
- $(this).removeAttr('disabled');
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement