Title: Javascript not working
Last modified: August 22, 2016

---

# Javascript not working

 *  [FiremanSam](https://wordpress.org/support/users/firemansam/)
 * (@firemansam)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/javascript-not-working-14/)
 * I created a website for a local school 2 years ago; and now they want the option
   to update the site themselves. I’m now re-creating all of the site within WordPress.
 * I’m stuck on one aspect and that is a page showing the staff members. When I 
   did this on the original site, it worked fine within a html page, but it won’t
   run within WordPress.
 * The original and working page is [http://www.ssj-school.co.uk/staff.htm](http://www.ssj-school.co.uk/staff.htm)
   and the new (WordPress) page is [http://www.ssj-school.co.uk/wp/staff](http://www.ssj-school.co.uk/wp/staff)
 * The WordPress page shows all of the images and text, but has none of the functionality.
   I’ve been searching for an answer for the last 2 days and tried so many different
   things, but nothing is working, any ideas?

Viewing 1 replies (of 1 total)

 *  [ifyouwillit](https://wordpress.org/support/users/ifyouwillit/)
 * (@ifyouwillit)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/javascript-not-working-14/#post-5268316)
 * It appears as though the old page uses the following code for the extra features:
 *     ```
       <script type="text/javascript"><!--
   
       				var arrOnImages = Array();
       				var arrOffImages = Array();
       				var intLastItem = 0;
   
       				function showBio(intId){
       					//hide last
       					var objEl = false;
   
       					if (intLastItem > 0){
       						objEl = document.getElementById("d"+intLastItem);
       						if (objEl){
       							objEl.style.display = "none";
       						}
       						objEl = document.getElementById("i"+intLastItem);
       						if (objEl){
       							objEl.src = arrOffImages[intLastItem];
       						}
       					}
       					objEl = document.getElementById("d"+intId);
       					if (objEl){
       						objEl.style.display = "block";
       					}
       					objEl = document.getElementById("i"+intId);
       					if (objEl){
       						objEl.src = arrOnImages[intId];
       					}
       					intLastItem = intId;
       					return false;
       				}
   
       			--></script>
       ```
   
 * When you add JavaScript through the WordPress visual editor, it will be stripped
   out. You have a few options:
    1.  -  Create a plugin to enqueue the JavaScript
           [http://codex.wordpress.org/Function_Reference/wp_enqueue_script](http://codex.wordpress.org/Function_Reference/wp_enqueue_script)
    2.  -  User a header/footer plugin (and add the javascript to the header) like 
          this one: [https://wordpress.org/plugins/header-footer/](https://wordpress.org/plugins/header-footer/)
    3.  -  Turn off the visual editing feature of the editor and only use code view.
          [http://wordpress.org/support/topic/turning-off-visual-editor?replies=3](http://wordpress.org/support/topic/turning-off-visual-editor?replies=3)

Viewing 1 replies (of 1 total)

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

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [ifyouwillit](https://wordpress.org/support/users/ifyouwillit/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/javascript-not-working-14/#post-5268316)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
