jQuery(function($) { $(document).ready(function() { $('#config_label_format').change(function() { const formatSelect = $(this); const typeSelect = $('#config_label_type'); if (formatSelect.val() != 'Pdf') { typeSelect.val('A6').prop('disabled', true); typeSelect.selectBox('update'); } else { typeSelect.prop('disabled', false); } }).change(); }); });