Title: trigger via javascript
Last modified: June 4, 2020

---

# trigger via javascript

 *  [apetruzzi](https://wordpress.org/support/users/apetruzzi/)
 * (@apetruzzi)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/trigger-via-javascript/)
 * Is there a way to trigger the modal using javascript? I tried using jQuery(‘.
   wow-modal-id-1’).click(); but it doesn’t work 🙁

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [apetruzzi](https://wordpress.org/support/users/apetruzzi/)
 * (@apetruzzi)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/trigger-via-javascript/#post-12939780)
 * figured it out. the plugin doesn’t support this directly, so i had to hack the
   hell out of it. Basically what I’m doing is rather than trying to trigger the
   modal with javascript, I am creating a hidden div with the modal html code and
   then using jQuery to clone html code (with events) and move it where I wanted.
 * first i added an action to wp_footer in my theme’s functions php that outputted
   a hidden div with an actual link calling the modal:
 * functions.php
    ————- add_action( ‘wp_footer’, ‘my_modal_code’ ); public function
   my_modal_code() { ?> <div style=”display:none;” id=”my_modal_code”> [Open Modal](https://wordpress.org/support/topic/trigger-via-javascript/?output_format=md#wow-modal-id-1)
   </div> <? }
 * Next I used jQuery to clone (with events) and move the html code where I want
   it.
 * sc = jQuery(‘#my_modal_code’).clone(true);
    jQuery(‘#my_modal_code’).remove();
   jQuery(‘p’).prepend( sc.show() );
 *  Plugin Author [Wow-Company](https://wordpress.org/support/users/wpcalc/)
 * (@wpcalc)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/trigger-via-javascript/#post-12946674)
 * Hello.
 * Unfortunately, the current version of the plugin does not support calling a modal
   window through a function.
 * Your decision has the right to life.
 *  If this function is needed, we can add it to future versions of the plugin.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘trigger via javascript’ is closed to new replies.

 * ![](https://ps.w.org/modal-window/assets/icon-256x256.png?rev=1470847)
 * [Modal Window - create popup modal window](https://wordpress.org/plugins/modal-window/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/modal-window/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/modal-window/)
 * [Active Topics](https://wordpress.org/support/plugin/modal-window/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/modal-window/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/modal-window/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Wow-Company](https://wordpress.org/support/users/wpcalc/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/trigger-via-javascript/#post-12946674)
 * Status: not resolved