Title: Javascript code not working, can you help?
Last modified: August 21, 2016

---

# Javascript code not working, can you help?

 *  [ChangeAgent](https://wordpress.org/support/users/changeagent/)
 * (@changeagent)
 * [12 years ago](https://wordpress.org/support/topic/javascript-code-not-working-can-you-help/)
 * I want to hide email adresses as much as we can on a site I made for a friend.
 * I use a little utility called ‘Email Obfuscator’ to generate the code. The code
   below is what I get if I choose Javascript.
 * <script>document.write(‘T’+’e’+’x’+’t’+’ ‘+’i’+’n’+’ ‘+’t’+’h’+’e’+’ ‘+’l’+’i’
   +’n’+’k’);</script>
 * However it does not seem to work, all I see on the site is this code. What do
   I do wrong?

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

 *  Moderator [cubecolour](https://wordpress.org/support/users/numeeja/)
 * (@numeeja)
 * [12 years ago](https://wordpress.org/support/topic/javascript-code-not-working-can-you-help/#post-4880563)
 * you could use one of the existing anti-spambot plugins for this.
    see: [http://codex.wordpress.org/Protection_From_Harvesters#Use_Anti_Spam_Plugins](http://codex.wordpress.org/Protection_From_Harvesters#Use_Anti_Spam_Plugins)
 *  Thread Starter [ChangeAgent](https://wordpress.org/support/users/changeagent/)
 * (@changeagent)
 * [12 years ago](https://wordpress.org/support/topic/javascript-code-not-working-can-you-help/#post-4880566)
 * Thanks, yes I was aware of these.
 * Tested them all and was not to happy with how they functioned. that is why I 
   was looking for an other option.
 * As I am not a coder myself, I thought I might be making a simple coding error.
 *  Thread Starter [ChangeAgent](https://wordpress.org/support/users/changeagent/)
 * (@changeagent)
 * [12 years ago](https://wordpress.org/support/topic/javascript-code-not-working-can-you-help/#post-4880579)
 * I have been checking a bit more, and when I paste
 * <script>document.write(‘T’+’e’+’x’+’t’+’ ‘+’i’+’n’+’ ‘+’t’+’h’+’e’+’ ‘+’l’+’i’
   +’n’+’k’);</script>
 * it is there. I save it, it is still there. I close the ‘Text’ window and open
   the ‘Visual’ window and back to ‘Text’ window and the code has changed to:
 * <script>// <![CDATA[
    document.write(‘T’+’e’+’x’+’t’+’ ‘+’i’+’n’+’ ‘+’t’+’h’+’
   e’+’ ‘+’l’+’i’+’n’+’k’); // ]]></script>
 * Is that the problem?
 *  Thread Starter [ChangeAgent](https://wordpress.org/support/users/changeagent/)
 * (@changeagent)
 * [12 years ago](https://wordpress.org/support/topic/javascript-code-not-working-can-you-help/#post-4880593)
 * I have formulated the question more clearly here:
 * [http://wordpress.org/support/topic/wp-changes-my-thus-breaking-it-after-pasting-it-in-to-the-‘text’-field?replies=0#post-5538363](http://wordpress.org/support/topic/wp-changes-my-thus-breaking-it-after-pasting-it-in-to-the-‘text’-field?replies=0#post-5538363)
 *  [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * (@lorro)
 * [12 years ago](https://wordpress.org/support/topic/javascript-code-not-working-can-you-help/#post-4880643)
 * The snippet works for me. I have checked your javascript line with [Lint](http://www.javascriptlint.com/online_lint.php)
   and its fine. The “// <![CDATA]” bit added by WordPress is interpreted as a comment
   by javascript so it is ignored. WordPress puts it in to ensure the javascript
   is not interpreted as html markup, which is good.
 * If you can try it in Chrome, and it still doesn’t work, press control-shift-J
   to bring up the console. Javascript errors are highlighted. Other browsers have
   similar tools.
 *  Thread Starter [ChangeAgent](https://wordpress.org/support/users/changeagent/)
 * (@changeagent)
 * [12 years ago](https://wordpress.org/support/topic/javascript-code-not-working-can-you-help/#post-4880668)
 * Thanks loro, sorry for the delay, I am on the road and wanted to test a bit more.
   Thanks for the Lint link, very helpful!
 * Let me explain what happens.
 * _[ Moderator note: Code fixed, please wrap code in [backticks or use the code button](http://codex.wordpress.org/Forum_Welcome#Posting_Code).]_
 * Code generated:
 *     ```
       <script>document.write('T'+'e'+'x'+'t'+' '+'i'+'n'+' '+'t'+'h'+'e'+' '+'l'+'i'+'n'+'k');</script>
       ```
   
 * once paste as described:
 *     ```
       <script>// <![CDATA[
       document.write('T'+'e'+'x'+'t'+' '+'i'+'n'+' '+'t'+'h'+'e'+' '+'l'+'i'+'n'+'k');
       // ]]></script>
       ```
   
 * What i see in the ‘Visual’ window of WP in admin:
    blank, nothing, empty space.
 * What I see in a browser when I go to the site where I pasted it (tested several
   browsers):
 *     ```
       < a href="mailto:youremail@yourprovider.com?subject=Email%20subject%20(optional)">Text in the link< /a>
       ```
   
 * what I see when I inspect in browser:
 *     ```
       <script>document.write('< '+'a'+' '+'h'+'r'+'e'+'f'+'='+'"'+'&'+'#'+'1'+'0'+'9'+';'+'&'+'#'+'9'+'7'+';'+'&'+'#'+'1'+'0'+'5'+';'+'&'+'#'+'1'+'0'+'8'+';'+'&'+'#'+'1'+'1'+'6'+';'+'&'+'#'+'1'+'1'+'1'+';'+'&'+'#'+'5'+'8'+';'+'&'+'#'+'1'+'2'+'1'+';'+'&'+'#'+'1'+'1'+'1'+';'+'&'+'#'+'1'+'1'+'7'+';'+'&'+'#'+'1'+'1'+'4'+';'+'&'+'#'+'1'+'0'+'1'+';'+'&'+'#'+'1'+'0'+'9'+';'+'&'+'#'+'9'+'7'+';'+'&'+'#'+'1'+'0'+'5'+';'+'&'+'#'+'1'+'0'+'8'+';'+'&'+'#'+'6'+'4'+';'+'&'+'#'+'1'+'2'+'1'+';'+'&'+'#'+'1'+'1'+'1'+';'+'&'+'#'+'1'+'1'+'7'+';'+'&'+'#'+'1'+'1'+'4'+';'+'&'+'#'+'1'+'1'+'2'+';'+'&'+'#'+'1'+'1'+'4'+';'+'&'+'#'+'1'+'1'+'1'+';'+'&'+'#'+'1'+'1'+'8'+';'+'&'+'#'+'1'+'0'+'5'+';'+'&'+'#'+'1'+'0'+'0'+';'+'&'+'#'+'1'+'0'+'1'+';'+'&'+'#'+'1'+'1'+'4'+';'+'&'+'#'+'4'+'6'+';'+'&'+'#'+'9'+'9'+';'+'&'+'#'+'1'+'1'+'1'+';'+'&'+'#'+'1'+'0'+'9'+';'+'?'+'s'+'u'+'b'+'j'+'e'+'c'+'t'+'='+'E'+'m'+'a'+'i'+'l'+'%'+'2'+'0'+'s'+'u'+'b'+'j'+'e'+'c'+'t'+'%'+'2'+'0'+'('+'o'+'p'+'t'+'i'+'o'+'n'+'a'+'l'+')'+'"'+'>'+'T'+'e'+'x'+'t'+' '+'i'+'n'+' '+'t'+'h'+'e'+' '+'l'+'i'+'n'+'k'+'< '+'/'+'a'+'>');</script>< a href="mailto:youremail@yourprovider.com?subject=Email%20subject%20(optional)">Text in the link< /a></p>
       ```
   
 * Something is not working the way it should. any ideas?
 * Thanks.

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

The topic ‘Javascript code not working, can you help?’ is closed to new replies.

## Tags

 * [java](https://wordpress.org/support/topic-tag/java/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 3 participants
 * Last reply from: [ChangeAgent](https://wordpress.org/support/users/changeagent/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/javascript-code-not-working-can-you-help/#post-4880668)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
