0

I need help, there are three buttons in my phtml file , In that page I want to one button is selected by default when the page is load or refresh in Magento 2?

0
0

Please try this,

<script type="text/javascript">
$(document).ready(function(){
     $("#modal").click();
});
</script>
0

Add the script in your phtml file,

<script type="text/javascript">
    require([
      'jquery'
    ], function($) {
        $(document).ready(function(){
            $("#buttonId").trigger('click');
        });
    })'
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.