Tuesday, 17 March 2020

How to set default custom option selected in magento 2

<script>
require(['jquery', 'jquery/ui'], function($){
  $('.product-add-form .field select').each(function(i, obj) {
    $(obj).find('option:eq(1)').prop('selected', true);
  });
});
</script>

OR
$('.product-add-form .field select').each(function(i, obj) {
  $(obj).find('option:eq(1)').prop('selected', true);
 });

No comments:

Post a Comment