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>
and
jQuery(document).on('change', 'select', function () {
$('.product_names option').hide();
});
jQuery(document).on('change', 'select', 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>
and
jQuery(document).ready(function() {
jQuery("select").change(function(){
$("select option").hide();
});
});
jQuery(document).ready(function() {
jQuery("select").change(function(){
$("select option").hide();
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<select class="product_names">
<option>Select option</option>
<option>Test1</option>
<option>Test2</option>
<option>Test3</option>
<option>Test4</option>
<option>Test5</option>
</select>