Events Made Easy Forums How do I … jQuery-linked button in DynamicData

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #60337
    Anonymous
    Inactive

    I’m trying to use a button to change css attributes on an RSVP form as:

    jQuery(document).ready(function(){
     jQuery("#ARCbutton").click(function(){
        jQuery(".non-cert").css({"display":'block' });
      });
    });
    

    The button/code works when the button is in an RSVP form template. But when the button is displayed dynamically it won’t fire.

    I’ve tried putting the code in the “Extra event html headers” and also directly loading the script via functions.php.

    The template to display dynamically is just
    <button type="button" id="ARCbutton">Show Form</button>

    What I’m trying to do is display added seats in a multi-seat event (class) but only when a code is entered, so I’m using display:none to hide the selections. When the code is entered, the button is displayed – then clicking the button changes the css to display:block and the new seat selections are displayed . . . but I can’t get the button to work after appearing through the #_DYNAMICDATA process.

    Any wisdom is much appreciated!

    #60338
    Franky
    Keymaster

    Since the button didn’t exist the moment the page was rendered, the action “click” didn’t register.
    The solution is to use the on-syntax (see eme.js). Example:

    $('.eme_submit_button').on('click', function(event) { .... }

    #60341
    Anonymous
    Inactive

    Of course!

    Thank you.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘How do I …’ is closed to new topics and replies.
Scroll to Top