Title: js code not working.
Last modified: September 3, 2016

---

# js code not working.

 *  [ntanwir10](https://wordpress.org/support/users/ntanwir10/)
 * (@ntanwir10)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/)
 * Its a great plugin.I was looking for something like this for some time now.
 * I have placed a button on my homepage and has written the javascript code in 
   your js editor.
 * But, the code is not taking effect. Not sure what wrong.

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/js-code-not-working/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/js-code-not-working/page/2/?output_format=md)

 *  Plugin Author [Tiny Code](https://wordpress.org/support/users/tinycode/)
 * (@tinycode)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/#post-8020992)
 * Could you show me your js code?
 * In current version, please don’t use // comment style; use jQuery instead of 
   $. I hope it will help you.
 * If your code still not working, please contact me: [tinycodestudio@gmail.com](https://wordpress.org/support/topic/js-code-not-working/tinycodestudio@gmail.com?output_format=md)
 *  Thread Starter [ntanwir10](https://wordpress.org/support/users/ntanwir10/)
 * (@ntanwir10)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/#post-8020997)
 * Hi,
 * Sure. This is my js code.
 *     ```
       function myImg(){
         window.name = "thiswin";
         newwin=open("http://185.105.4.132/~zen/player/zenradio.html", "dispwin",
                     "width=750,height=300,scrollbars=no, menubar=no");
       }
       ```
   
 * This code is to open the link in a new window.
 *  Plugin Author [Tiny Code](https://wordpress.org/support/users/tinycode/)
 * (@tinycode)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/#post-8021001)
 *     ```
       function myImg(){
         window.name = "thiswin";
         newwin = window.open("http://185.105.4.132/~zen/player/zenradio.html", "dispwin",
                     "width=750,height=300,scrollbars=no, menubar=no");
       }
       ```
   
 * I modified your code, please try it.
 *  Thread Starter [ntanwir10](https://wordpress.org/support/users/ntanwir10/)
 * (@ntanwir10)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/#post-8021002)
 * Still. no success.
 *  Plugin Author [Tiny Code](https://wordpress.org/support/users/tinycode/)
 * (@tinycode)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/#post-8021003)
 * Could you give me your website link? If you do not want to public it, you can
   send to my email: [tinycodestudio@gmail.com](https://wordpress.org/support/topic/js-code-not-working/tinycodestudio@gmail.com?output_format=md)
 *  Thread Starter [ntanwir10](https://wordpress.org/support/users/ntanwir10/)
 * (@ntanwir10)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/#post-8021004)
 * Sure.
 * [http://185.105.4.132/~zen/](http://185.105.4.132/~zen/)
 *  Plugin Author [Tiny Code](https://wordpress.org/support/users/tinycode/)
 * (@tinycode)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/#post-8021006)
 * You should add onclick=”myImg()” to the button. Like this:
    `<a onclick="myImg()"
   href="javascript:void(0);" target="_self" class="gdl-button small" style="color:#
   fff; background-color:#ff7000; border-color:#cc5a00; ">LISTEN HERE</a>` I use
   href=”javascript:void(0);” instead of URL to prevent browser go to that URL.
 *  Thread Starter [ntanwir10](https://wordpress.org/support/users/ntanwir10/)
 * (@ntanwir10)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/#post-8021007)
 * <p style=”text-align: center;”>[button color=”#fff” background=”#ff7000″ size
   =”small” onclick=”myImg()” href=”javascript:void(0);” src=”[http://185.105.4.132/~zen/player/zenradio.html&#8221](http://185.105.4.132/~zen/player/zenradio.html&#8221);
   target=”_blank”]LISTEN HERE[/button]</p>
 * This is my button code.
 *  Plugin Author [Tiny Code](https://wordpress.org/support/users/tinycode/)
 * (@tinycode)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/#post-8021008)
 * I see… You have to add ID to the button, and then use jQuery to set onclick action.
   Change your button to:
    `<p style="text-align: center;">[button color="#fff" 
   background="#ff7000" size="small" id="listenhere" src="javascript:void(0);" target
   ="_self"]LISTEN HERE[/button]</p>`
 * then add this to Custom Javascript:
 *     ```
       function myImg(){
         newwin = window.open("http://185.105.4.132/~zen/player/zenradio.html", "dispwin", "width=750,height=300,scrollbars=no, menubar=no");
       }
   
       jQuery('#listenhere').click(myImg());
       ```
   
 *  Thread Starter [ntanwir10](https://wordpress.org/support/users/ntanwir10/)
 * (@ntanwir10)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/#post-8021009)
 * nothing is happening. Button is not working.
 *  Plugin Author [Tiny Code](https://wordpress.org/support/users/tinycode/)
 * (@tinycode)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/#post-8021010)
 * Change JS to below code, notice the ; (semicolon) after myImg function.
 *     ```
       function myImg(){
         newwin = window.open("http://185.105.4.132/~zen/player/zenradio.html", "dispwin", "width=750,height=300,scrollbars=no, menubar=no");
       };
   
       jQuery('body.home .gdl-button').click(myImg());
       ```
   
 * and make sure your browser allows popup (very important if you want to open in
   new window).
 *  Thread Starter [ntanwir10](https://wordpress.org/support/users/ntanwir10/)
 * (@ntanwir10)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/#post-8021011)
 * nope. still doesn’t work.
 *  Plugin Author [Tiny Code](https://wordpress.org/support/users/tinycode/)
 * (@tinycode)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/#post-8021013)
 *     ```
       function myImg(){
         newwin = window.open("http://185.105.4.132/~zen/player/zenradio.html", "dispwin", "width=750,height=300,scrollbars=no, menubar=no");
       };
   
       jQuery('body.home .gdl-button').click(function() { myImg(); });
       ```
   
 * Please copy exactly this code. body.home and .gdl-button have spacebar between
 *  Thread Starter [ntanwir10](https://wordpress.org/support/users/ntanwir10/)
 * (@ntanwir10)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/#post-8021014)
 * yes, thats exactly what I was doing.
 * anyway, it works now.
 *  Plugin Author [Tiny Code](https://wordpress.org/support/users/tinycode/)
 * (@tinycode)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/#post-8021015)
 * Thank god, It works, haha.
    Today I’m feeling so confused, made too many mistakes.
   Sorry for wasting your time 🙁

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/js-code-not-working/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/js-code-not-working/page/2/?output_format=md)

The topic ‘js code not working.’ is closed to new replies.

 * ![](https://ps.w.org/tc-custom-javascript/assets/icon-256x256.png?rev=1144538)
 * [TC Custom JavaScript](https://wordpress.org/plugins/tc-custom-javascript/)
 * [Support Threads](https://wordpress.org/support/plugin/tc-custom-javascript/)
 * [Active Topics](https://wordpress.org/support/plugin/tc-custom-javascript/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tc-custom-javascript/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tc-custom-javascript/reviews/)

 * 17 replies
 * 2 participants
 * Last reply from: [Tiny Code](https://wordpress.org/support/users/tinycode/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/js-code-not-working/page/2/#post-8021017)