Title: shortcode and javascript trigger click
Last modified: January 28, 2021

---

# shortcode and javascript trigger click

 *  Resolved [nickyg81](https://wordpress.org/support/users/nickyg81/)
 * (@nickyg81)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/shortcode-and-javascript-trigger-click/)
 * feed=”[https://yourdomain.com/01.mp3](https://yourdomain.com/01.mp3)
 * the guide tells me you can activate the click on the NON sticky reader with this
   JS code:
    `jQuery('[data-albums="75"]').find('li:nth-child(2) .audio-track').
   trigger( "click" );`
 * i can’t figure out how to insert the JS into my wp site.
 * I would like to create a series of posts with a button for each post, this button
   on click will send the link in a php variable which will replace the external
   link in the do_shortcode.
 * How can I activate this thing?the guide is totally absent in this regard.
 * 2. can I remove the play next previous track controls?
    3. How can I activate
   a trigger on the custom play / pause?

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

 *  Plugin Author [sonaar](https://wordpress.org/support/users/sonaar/)
 * (@sonaar)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/shortcode-and-javascript-trigger-click/#post-13971020)
 * Hi there,
 * there are multiple ways to add javascript to your website.
    You can add it in
   HTML with:
 *     ```
       <script>
       jQuery('[data-albums="75"]').find('li:nth-child(2) .audio-track').trigger( "click" );
       </script>
       ```
   
 * or use a third party plugin such as [https://wordpress.org/plugins/insert-script-in-headers-and-footers/](https://wordpress.org/plugins/insert-script-in-headers-and-footers/)
 * I think you will need to hire a WordPress developer to customize it to your needs.
 * 2: how will people be able to listen to the audio if you remove the play control?
   
   you can remove any assets using display:none; css on elements you want to hide.
 * 3: you can do it with Javascript as the example provided above or in this article
   [https://sonaar.ticksy.com/article/15282](https://sonaar.ticksy.com/article/15282)
 *  Thread Starter [nickyg81](https://wordpress.org/support/users/nickyg81/)
 * (@nickyg81)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/shortcode-and-javascript-trigger-click/#post-13972298)
 * ok I insert this code in the footer.
    But I wanted to understand what the trigger
   command is like on a buttom, image, link element. This is not written. The event
   to be assigned to the click of the link to load the mp3 in the shortcode (do_shortcode)
 * [Button click] ——-> trigger audio url in shortcode feed = “audio.mp3″
 * in footer…
    <script> jQuery(‘[data-albums=”75”]’).find(‘li:nth-child(2) .audio-
   track’).trigger( “click” ); </script>
 *  Plugin Author [sonaar](https://wordpress.org/support/users/sonaar/)
 * (@sonaar)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/shortcode-and-javascript-trigger-click/#post-13979608)
 * Sorry I dont correctly understand your question/formulation of the question.
 * Please check with your WordPress developer on how to implement js call into your
   theme, as this can be very different from different themes and plugins.
 *  Thread Starter [nickyg81](https://wordpress.org/support/users/nickyg81/)
 * (@nickyg81)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/shortcode-and-javascript-trigger-click/#post-13982605)
 * i am the developer of my theme and i am asking you how i should implement js 
   calls for your plugin.
 * How should I insert the link with js calls to your player?
    all by implementing
   shortcode with links (feed = “[https://www.domain.com/01.mp3](https://www.domain.com/01.mp3))
 * Why not put detailed examples in the guide?
    You have just written the script
   code to insert and stop!
 * jQuery (‘[data-albums = “75”]’). find (‘li: nth-child (2) .audio-track’). trigger(“
   click”);
 *  Plugin Author [sonaar](https://wordpress.org/support/users/sonaar/)
 * (@sonaar)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/shortcode-and-javascript-trigger-click/#post-13982745)
 * Well, js can be implemented in different ways depending on your setup and what
   you are trying to achieve…
 * You can add jQuery/JS on your custom button with something like
 *     ```
       $('#button1').click(function(){ 
          $('[data-albums="75"]').find('li:nth-child(2) .audio-track').trigger( "click" );
       });
       ```
   
 * This is just an example and I have not tested this code.
 * Please note that implementing your own JS code is beyond the scope of our free
   support.Thanks for your understanding.

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

The topic ‘shortcode and javascript trigger click’ is closed to new replies.

 * ![](https://ps.w.org/mp3-music-player-by-sonaar/assets/icon.svg?rev=1865553)
 * [MP3 Audio Player – Music Player, Podcast Player & Radio by Sonaar](https://wordpress.org/plugins/mp3-music-player-by-sonaar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mp3-music-player-by-sonaar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mp3-music-player-by-sonaar/)
 * [Active Topics](https://wordpress.org/support/plugin/mp3-music-player-by-sonaar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mp3-music-player-by-sonaar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mp3-music-player-by-sonaar/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [jquery](https://wordpress.org/support/topic-tag/jquery/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 5 replies
 * 2 participants
 * Last reply from: [sonaar](https://wordpress.org/support/users/sonaar/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/shortcode-and-javascript-trigger-click/#post-13982745)
 * Status: resolved