Title: Javascript issue on category pages
Last modified: August 19, 2016

---

# Javascript issue on category pages

 *  Resolved [pg73](https://wordpress.org/support/users/pg73/)
 * (@pg73)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/javascript-issue-on-category-pages/)
 * Hi
 * I hope someone can help. I have a background image used in a search input box,
   so that it’s there until someone clicks in the box to enter their text. There’s
   code in the footer (which is used on every page) and links to a .js file. It 
   works fine on pages that are only one level deep ie ‘/about’, ‘/contact’, ‘/name-
   of-post’ but if it’s more than that it won’t work ie ‘/category/business’, ‘/
   page/2’, ‘/2010/09’.
 * Below is the js used, I’m hoping someone can see an issue with it that would 
   cause this problem. Thanks.
 *     ```
       (function() {
           var id = document.getElementById('search-form');
           if (id && id.s) {
             var name = id.s;
             var unclicked = function() {
                 if (name.value == '') {
                     name.style.background = '#FFFFFF url(/wp-content/themes/mytheme/images/search-this-site.png) left no-repeat';
                 }
              };
              var clicked = function() {
                 name.style.background = '#ffffff';
              };
           name.onfocus = clicked;
           name.onblur = unclicked;
           unclicked();
           }
         })();
       ```
   

The topic ‘Javascript issue on category pages’ 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/)
 * 0 replies
 * 1 participant
 * Last reply from: [pg73](https://wordpress.org/support/users/pg73/)
 * Last activity: [15 years, 8 months ago](https://wordpress.org/support/topic/javascript-issue-on-category-pages/)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
