{"id":4188327,"date":"2013-10-04T00:25:00","date_gmt":"2013-10-04T00:25:00","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/java-script-error-1\/"},"modified":"2016-08-21T05:45:01","modified_gmt":"2016-08-21T05:45:01","slug":"java-script-error-1","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/java-script-error-1\/","title":{"rendered":"java script error"},"content":{"rendered":"<p>im having various problems with my site i believe its something to do with this:<\/p>\n<pre><code>catInput.autocomplete({\n\n                minLength: 0,\n\n                source: categories,\n\n                focus: function( event, ui ) {\n\n                    catInput.val( ui.item.label.replace(\/&amp;\/g, &quot;&amp;&quot;) );\n\n                    return false;\n\n                },\n\n                select: function( event, ui ) {\n\n                    catInput.val( ui.item.label.replace(\/&amp;\/g, &quot;&amp;&quot;) );\n\n                    catInputID.val( ui.item.value );\n\n                    return false;\n\n                }\n\n            }).data( &quot;autocomplete&quot; )._renderItem = function( ul, item ) {\n\n                return $( &quot;&lt;li&gt;&quot; )\n\n                    .data( &quot;item.autocomplete&quot;, item )\n\n                    .append( &quot;&lt;a&gt;&quot; + item.label + &quot;&lt;\/a&gt;&quot; )\n\n                    .appendTo( ul );\n\n            };<\/code><\/pre>\n<p>But im not too sure on where to locate this.. someone please help as its stressing me out! :@ <\/p>\n<p>ANY help with this would be appreciated!<br \/>\nThis is the full script that is causing the error: <\/p>\n<pre><code>&lt;script&gt;\n\n        jQuery(document).ready(function($) {\n\n            var categories = [\n\n                { value: &quot;23&quot;, label: &quot;Arts &amp; Crafts&quot; },\n\n                { value: &quot;12&quot;, label: &quot;Catering&quot; },\n\n                { value: &quot;26&quot;, label: &quot;Days Out&quot; },\n\n                { value: &quot;27&quot;, label: &quot;Food &amp; Dining&quot; },\n\n                { value: &quot;28&quot;, label: &quot;Health &amp; Beauty&quot; },\n\n                { value: &quot;24&quot;, label: &quot;Party Services\\\/Entertainers&quot; },\n\n                { value: &quot;17&quot;, label: &quot;Play Areas&quot; },\n\n                { value: &quot;14&quot;, label: &quot;Play Sessions&quot; },\n\n                { value: &quot;25&quot;, label: &quot;Services &amp; Trade&quot; },\n\n                { value: &quot;19&quot;, label: &quot;Shopping&quot; },\n\n                { value: &quot;11&quot;, label: &quot;Sports&quot; }\n\n            ];\n\n            var locations = [\n\n                { value: &quot;5&quot;, label: &quot;Liverpool&quot; },\n\n                { value: &quot;6&quot;, label: &quot;St Helens&quot; }\n\n            ];\n\n            var catInput = $( &quot;#dir-searchinput-category&quot; ),\n\n                catInputID = $( &quot;#dir-searchinput-category-id&quot; ),\n\n                locInput = $( &quot;#dir-searchinput-location&quot; ),\n\n                locInputID = $( &quot;#dir-searchinput-location-id&quot; );\n\n            catInput.autocomplete({\n\n                minLength: 0,\n\n                source: categories,\n\n                focus: function( event, ui ) {\n\n                    catInput.val( ui.item.label.replace(\/&amp;\/g, &quot;&amp;&quot;) );\n\n                    return false;\n\n                },\n\n                select: function( event, ui ) {\n\n                    catInput.val( ui.item.label.replace(\/&amp;\/g, &quot;&amp;&quot;) );\n\n                    catInputID.val( ui.item.value );\n\n                    return false;\n\n                }\n\n            }).data( &quot;autocomplete&quot; )._renderItem = function( ul, item ) {\n\n                return $( &quot;&lt;li&gt;&quot; )\n\n                    .data( &quot;item.autocomplete&quot;, item )\n\n                    .append( &quot;&lt;a&gt;&quot; + item.label + &quot;&lt;\/a&gt;&quot; )\n\n                    .appendTo( ul );\n\n            };\n\n            var catList = catInput.autocomplete( &quot;widget&quot; );\n\n            catList.niceScroll({ autohidemode: false });\n\n            catInput.click(function(){\n\n                catInput.val(&#039;&#039;);\n\n                catInputID.val(&#039;0&#039;);\n\n                catInput.autocomplete( &quot;search&quot;, &quot;&quot; );\n\n            });\n\n            locInput.autocomplete({\n\n                minLength: 0,\n\n                source: locations,\n\n                focus: function( event, ui ) {\n\n                    locInput.val( ui.item.label.replace(\/&amp;\/g, &quot;&amp;&quot;) );\n\n                    return false;\n\n                },\n\n                select: function( event, ui ) {\n\n                    locInput.val( ui.item.label.replace(\/&amp;\/g, &quot;&amp;&quot;) );\n\n                    locInputID.val( ui.item.value );\n\n                    return false;\n\n                },\n\n                open: function(event, ui) {\n\n                }\n\n            }).data( &quot;autocomplete&quot; )._renderItem = function( ul, item ) {\n\n                return $( &quot;&lt;li&gt;&quot; )\n\n                    .data( &quot;item.autocomplete&quot;, item )\n\n                    .append( &quot;&lt;a&gt;&quot; + item.label + &quot;&lt;\/a&gt;&quot; )\n\n                    .appendTo( ul );\n\n            };\n\n            var locList = locInput.autocomplete( &quot;widget&quot; );\n\n            locList.niceScroll({ autohidemode: false });\n\n            locInput.click(function(){\n\n                locInput.val(&#039;&#039;);\n\n                locInputID.val(&#039;0&#039;);\n\n                locInput.autocomplete( &quot;search&quot;, &quot;&quot; );\n\n            });\n\n        });\n\n        &lt;\/script&gt;<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-4188327","topic","type-topic","status-closed","hentry","topic-tag-java","topic-tag-javascript-errors"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4188327","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4188327\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=4188327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}