0

This isn't specific to Joomla except that I'm triggering a yootheme Widgetkit action. I have an email sign up form that loads via a javascript, and I've placed it inside a widgetkit lightbox.

I've seen this page: http://yootheme.com/support/question/36003 And it shows the command needed: ('#lightbox-close').trigger('click') running this would trigger the close action on the modal lightbox, closing it.

But because the submit button on this form is pulled into the page via javascript, I can't edit the form itself.

So I was trying to put the script above the form.

Here's what I know for sure doesn't work:

<script type="text/javascript">$("#e2ma_signup_submit_button").click(function () {
$('#lightbox-close').trigger('click');
});</script>

e2ma_signup_submit_button is the ID of the submit button in the form.

Anyone with any amount of jquery skill can probably get this working in a few seconds, so any help would be appreciated.

1

Try this:

<script type="text/javascript">
$(document).ready(function() {
    $('#e2ma_signup_submit_button').on('click', function() {
        $('#lightbox-close').trigger('click');
    });
});
</script>

If it doesn't work, replace $(document).ready(function() { with

jQuery(document).ready(function($) {

JSFiddle - Demo

  • Yes! I had to use the JQuery line, but it totally works. Thanks! – Brian Peat Jan 1 '15 at 3:29
  • You're welcome! Glad it helped. – Farahmand Jan 1 '15 at 7:12

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.