WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] java script error

[Resolved] java script error

  • 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)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] java script error’ is closed to new replies.