Title: java script error
Last modified: August 21, 2016

---

# java script error

 *  Resolved [webbie2004](https://wordpress.org/support/users/webbie2004/)
 * (@webbie2004)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/java-script-error-1/)
 * im having various problems with my site i believe its something to do with this:
 *     ```
       catInput.autocomplete({
   
                       minLength: 0,
   
                       source: categories,
   
                       focus: function( event, ui ) {
   
                           catInput.val( ui.item.label.replace(/&/g, "&") );
   
                           return false;
   
                       },
   
                       select: function( event, ui ) {
   
                           catInput.val( ui.item.label.replace(/&/g, "&") );
   
                           catInputID.val( ui.item.value );
   
                           return false;
   
                       }
   
                   }).data( "autocomplete" )._renderItem = function( ul, item ) {
   
                       return $( "<li>" )
   
                           .data( "item.autocomplete", item )
   
                           .append( "<a>" + item.label + "</a>" )
   
                           .appendTo( ul );
   
                   };
       ```
   
 * But im not too sure on where to locate this.. someone please help as its stressing
   me out! :@
 * ANY help with this would be appreciated!
    This is the full script that is causing
   the error:
 *     ```
       <script>
   
               jQuery(document).ready(function($) {
   
                   var categories = [
   
                       { value: "23", label: "Arts & Crafts" },
   
                       { value: "12", label: "Catering" },
   
                       { value: "26", label: "Days Out" },
   
                       { value: "27", label: "Food & Dining" },
   
                       { value: "28", label: "Health & Beauty" },
   
                       { value: "24", label: "Party Services\/Entertainers" },
   
                       { value: "17", label: "Play Areas" },
   
                       { value: "14", label: "Play Sessions" },
   
                       { value: "25", label: "Services & Trade" },
   
                       { value: "19", label: "Shopping" },
   
                       { value: "11", label: "Sports" }
   
                   ];
   
                   var locations = [
   
                       { value: "5", label: "Liverpool" },
   
                       { value: "6", label: "St Helens" }
   
                   ];
   
                   var catInput = $( "#dir-searchinput-category" ),
   
                       catInputID = $( "#dir-searchinput-category-id" ),
   
                       locInput = $( "#dir-searchinput-location" ),
   
                       locInputID = $( "#dir-searchinput-location-id" );
   
                   catInput.autocomplete({
   
                       minLength: 0,
   
                       source: categories,
   
                       focus: function( event, ui ) {
   
                           catInput.val( ui.item.label.replace(/&/g, "&") );
   
                           return false;
   
                       },
   
                       select: function( event, ui ) {
   
                           catInput.val( ui.item.label.replace(/&/g, "&") );
   
                           catInputID.val( ui.item.value );
   
                           return false;
   
                       }
   
                   }).data( "autocomplete" )._renderItem = function( ul, item ) {
   
                       return $( "<li>" )
   
                           .data( "item.autocomplete", item )
   
                           .append( "<a>" + item.label + "</a>" )
   
                           .appendTo( ul );
   
                   };
   
                   var catList = catInput.autocomplete( "widget" );
   
                   catList.niceScroll({ autohidemode: false });
   
                   catInput.click(function(){
   
                       catInput.val('');
   
                       catInputID.val('0');
   
                       catInput.autocomplete( "search", "" );
   
                   });
   
                   locInput.autocomplete({
   
                       minLength: 0,
   
                       source: locations,
   
                       focus: function( event, ui ) {
   
                           locInput.val( ui.item.label.replace(/&/g, "&") );
   
                           return false;
   
                       },
   
                       select: function( event, ui ) {
   
                           locInput.val( ui.item.label.replace(/&/g, "&") );
   
                           locInputID.val( ui.item.value );
   
                           return false;
   
                       },
   
                       open: function(event, ui) {
   
                       }
   
                   }).data( "autocomplete" )._renderItem = function( ul, item ) {
   
                       return $( "<li>" )
   
                           .data( "item.autocomplete", item )
   
                           .append( "<a>" + item.label + "</a>" )
   
                           .appendTo( ul );
   
                   };
   
                   var locList = locInput.autocomplete( "widget" );
   
                   locList.niceScroll({ autohidemode: false });
   
                   locInput.click(function(){
   
                       locInput.val('');
   
                       locInputID.val('0');
   
                       locInput.autocomplete( "search", "" );
   
                   });
   
               });
   
               </script>
       ```
   

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

 *  [graphical_force](https://wordpress.org/support/users/graphical_force/)
 * (@graphical_force)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/java-script-error-1/#post-4188534)
 * We need more information. Can you post a link to your site which is giving you
   the error?
 *  Thread Starter [webbie2004](https://wordpress.org/support/users/webbie2004/)
 * (@webbie2004)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/java-script-error-1/#post-4188622)
 * Hi,
 * Its [http://www.liverpooldaysout.co.uk](http://www.liverpooldaysout.co.uk)
 * Thanks lucy
 *  [Vignesh Pichamani](https://wordpress.org/support/users/viky081/)
 * (@viky081)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/java-script-error-1/#post-4188630)
 * What type of problem you are facing through this script?
 *  Thread Starter [webbie2004](https://wordpress.org/support/users/webbie2004/)
 * (@webbie2004)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/java-script-error-1/#post-4188705)
 * other java script is not processing because of the error in this code.
 *  [graphical_force](https://wordpress.org/support/users/graphical_force/)
 * (@graphical_force)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/java-script-error-1/#post-4188706)
 * I’m not getting any errors when using dev tools. Can you describe the problem
   that you are having?
 *  Thread Starter [webbie2004](https://wordpress.org/support/users/webbie2004/)
 * (@webbie2004)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/java-script-error-1/#post-4188785)
 * im not 100% sure but i think that this is the cause for other plugin’s not functioning
   correctly, ive installed another plugin and it seems to be oka for now. but would
   still like to know where this code is so i can fix it
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [12 years, 7 months ago](https://wordpress.org/support/topic/java-script-error-1/#post-4188786)
 * Try deactivating all plugins until the problem goes away. If it does then you
   have a method for finding the plugin with the problem. If it doesn’t then your
   theme may be responsible and you’ll need to contact who ever gave you it for 
   assistance.

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

The topic ‘java script error’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 4 participants
 * Last reply from: [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/java-script-error-1/#post-4188786)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
