I'm looking to create a simple jQuery plugin, but my current code only works in Firefox. How can I modify it to work in other browsers like Google Chrome, Opera, and others?
When selecting option value='business'
, the is--hidden
class should be removed from the .address--company
element. But when choosing option value='private'
, the is--hidden
class should be added to the .address--company
element.
HTML:
<div class="address--customertype">
<div class="select-field">
<select name="address[additional][customer_type]" required="required" aria-required="true" class="is--required">
<option value="private" selected="selected">Klient indywidualny</option>
<option value="business">Firma</option>
</select>
</div>
</div>
<div class="address--company is--hidden">...</div>
jQuery:
$('select[name="address[additional][customer_type]"] option[value="business"]').click(function() {
if ($('.address--company').hasClass('is--hidden')) {
$('.address--company').removeClass('is--hidden');
}
});