Title: Javascript in short code not working
Last modified: August 21, 2016

---

# Javascript in short code not working

 *  [nmoore](https://wordpress.org/support/users/nmoore-1/)
 * (@nmoore-1)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/javascript-in-short-code-not-working/)
 * So I’ve been asked to insert a javascript widget for a job posting site on a 
   single page with in our wordpress website.
 * This is the script code
    `<script type="text/javascript" src="https://www.ziprecruiter.
   com/jobs-widget/v1/7d9477b9?show_posted_days=0"></script><a href="https://www.
   ziprecruiter.com" id="jobs_widget_link">Powered by ZipRecruiter</a>`
 * I created the shortcode in functions.php. It looks like this
 *     ```
       function jobpost_func( $atts ){
       	return '<script type="text/javascript" src="https://www.ziprecruiter.com/jobs-widget/v1/7d9477b9?show_posted_days=0"></script><a href="https://www.ziprecruiter.com" id="jobs_widget_link">Powered by ZipRecruiter</a>';
       }
       add_shortcode( 'jobpost', 'jobpost_func' );
       ```
   
 * and added this on the test page I am trying to create
    [jobpost]
 * Only the link shows. So to test if it was just the javascript it didn’t like 
   I tried this in the short code instead.
 *     ```
       function jobpost_func( $atts ){
       	return "<script>alert('hello world');</script>";
       }
       add_shortcode( 'jobpost', 'jobpost_func' );
       ```
   
 * The Hello World works! I’ve been working on this for days now and tried a lot
   of different suggested approaches. This is the closest I have gotten. Is there
   something I am missing? Please help.

The topic ‘Javascript in short code not working’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [nmoore](https://wordpress.org/support/users/nmoore-1/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/javascript-in-short-code-not-working/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
