the answer for all question about Oxygen Builder plugin and WordPress

Need some jQuery help – I’m trying to trigger a click on my .fwp-submit button when one of the optio

Need some jQuery help – I’m trying to trigger a click on my .fwp-submit button when one of the options in a dropdown is selected. Where am I going wrong?
jQuery( “.facetwp-dropdown option” ).click(function() {
jQuery( “.fwp-submit” ).trigger(“click”);
});



Source

Boundaries

Restro Design Set

3 Comments
  1. Gavin says

    Hey Alex if you are still struggling happy to take a look at this tomorrow for you – drop me a message 👍

  2. Andy says

    Instead of a click, could you do a toggleClass and use display or opacity?

  3. Sebastian says

    I assume you want to simulate a button press after something get’s selected. The option element you are targeting does not support the onclick event though. What you should do instead is listening for the onchange event on the select tag and run your code from there.

    Try this instead:
    //get the select element
    const theSelectInput = document.querySelector(‘.facetwp-dropdown’);
    //get the button
    const theSubmitButton = document.querySelector(‘.fwp-submit’);
    //listen for onchange
    theSelectInput.onchange = function(){
    //simulate the click
    theSubmitButton.click();
    };

    https://codepen.io/sebastian-piskaty/pen/BawvxzL

Leave A Reply

Your email address will not be published.

Oxyrealm Docs OxyMade - Oxygen Builder Design Set Mega collection