Title: Getting javascript to work&#8230;
Last modified: August 22, 2016

---

# Getting javascript to work…

 *  [JeffGilbert](https://wordpress.org/support/users/jeffgilbert/)
 * (@jeffgilbert)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/getting-javascript-to-work/)
 * Arghhhh! Just wanted to start there.
 * I’ve got a simple javascript that works fine in a stand alone html file but mocks
   me when placed in a WP page.
 * I enqued the script in functions.php
 * `wp_enqueue_script('guts-faq-collapse', get_template_directory_uri() . '/js/collapse.
   js', array(), 20141005, true);`
 * Are there limitations for JS in WP? If so, where can I read up on what to expect
   and how to overcome what should be simple issues? I would really appreciate any
   help. I put html below that shows the effect I’m trying to make happen.
 *     ```
       <html>
   
       <head>
       <script language="JavaScript" type="text/javascript">
       if (document.getElementById) {
       document.writeln('<style type="text/css"><!--')
       document.writeln('.texter {display:none} @media print {.texter {display:block;}}')
       document.writeln('//--></style>') }
       function openClose(theID) {
       if (document.getElementById(theID).style.display == "block") { document.getElementById(theID).style.display = "none" }
       else { document.getElementById(theID).style.display = "block" } }
       // -->
       </script>
       </head>
   
       <body >
   
       <span >
       <div onclick="openClose('a1')" style="cursor: pointer;">
       	<span style="color: #708B28;">The Content Title</span><br>
       </div>
       <div id="a1" class="texter">
       This is the content that shows when you click the title.<br>
       </div>
       </span>
       </body>
       </html>
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [JeffGilbert](https://wordpress.org/support/users/jeffgilbert/)
 * (@jeffgilbert)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/getting-javascript-to-work/#post-5449037)
 * I ended up using the RAW HTML plugin. It did the trick. For someone new to WP…
   the reformatting stuff is very aggravating.

Viewing 1 replies (of 1 total)

The topic ‘Getting javascript to work…’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [JeffGilbert](https://wordpress.org/support/users/jeffgilbert/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/getting-javascript-to-work/#post-5449037)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
