When the page loads I want all the dropdown option to hide. I tried this with CSS using display: none
. I tried with jQuery. However none of these is working in Safari. The code works in Chrome but not in Safari.
I've tried:
jQuery(document).ready(function ($) {
$(".product_names option").hide();
});
jQuery("select").change(function() {
$(".product_names option").hide();
});
<select class="product_names">
<option>Select option</option>
<option>Test1</option>
<option>Test2</option>
<option>Test3</option>
<option>Test4</option>
<option>Test5</option>
</select>
See Question&Answers more detail:os