WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] java script error (8 posts)

  1. webbie2004
    Member
    Posted 11 months ago #

    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>
  2. graphical_force
    Member
    Posted 11 months ago #

    We need more information. Can you post a link to your site which is giving you the error?

  3. webbie2004
    Member
    Posted 11 months ago #

    Hi,

    Its http://www.liverpooldaysout.co.uk

    Thanks lucy

  4. viky081
    Member
    Posted 11 months ago #

    What type of problem you are facing through this script?

  5. webbie2004
    Member
    Posted 11 months ago #

    other java script is not processing because of the error in this code.

  6. graphical_force
    Member
    Posted 11 months ago #

    I'm not getting any errors when using dev tools. Can you describe the problem that you are having?

  7. webbie2004
    Member
    Posted 11 months ago #

    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

  8. Andrew
    Forum Moderator
    Posted 11 months ago #

    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.

Reply

You must log in to post.

About this Topic