Resolve the not a function error in the webpage - javascript

This is a screenshot of the error from Developer console in browser:
Now, I understand that the error occurs because .suggest() is not a function but it is being called in ajax.js?ver=1.6.5:1287. I don't fully understand what the errors information provided below that means. The lines i etc. Am I supposed to find the .suggest() function in jquery.js?ver=1.12.4-wp:2?
Here is the code from ajax.js:
jQuery(document).ready(function ($) {
$('#wpf_tags').suggest(
window.ajaxurl + "?action=wpforo_tag_search",
{ multiple:true,
multipleSep: ",",
resultsClass: 'wpf_ac_results',
selectClass: 'wpf_ac_over',
matchClass: 'wpf_ac_match',
onSelect: function() {}
}
);
// More code
This is from a WordPress plugin which works fine with the default 2019 theme. However, it throws up the error when I use it with a theme I created. I am loading jQuery version 3.3.1 in the footer of my theme. Can this be the reason for the above error?
Thanks.
UPDATE
I added the plugin to the footer of the webpage but the error still did not disappear. After that I looked at the source code of the page by pressing Ctrl + U. This showed me that the problematic file ajax.js loads on line 102. However, the suggest plugin loads on line 515.
I have no control over the source code on that page because it is generated by the WordPress plugin. How can I load these files in proper order?
Thanks.

Related

JQueryUi Autocomplete Combobox sometimes not loading properly in Firefox

I am using JQueryUi 1.12.1 version and JQuery 3.2.1 version.
I am trying to use 2 JQueryUI Autocomplete Comboboxes in my website, so I copied Combobox code from here, changed it a little bit and added to JS file twice (with widget names 'combobox' and 'combobox2', they have diffrent logic and they are dependent on each other). In latest version of Chrome it's working as intended, but in Firefox sometimes (mostly on first loading of page after closing browser, but if I refresh page constantly something like 1 of 10 tries is ending up with error) I have an error saying:
TypeError: jQuery(...).combobox is not a function.
Here is my js file code:
jQuery(document).ready(
function ($) {
$.widget( "custom.combobox", {
//code...
});
$.widget( "custom.combobox2", {
//code...
});
jQuery('#id_substancename').combobox();
jQuery('#id_casnumber').combobox2();
//code...
});
Changing:
jQuery('#id_substancename').combobox();
jQuery('#id_casnumber').combobox2();
To:
$('#id_substancename').combobox();
$('#id_casnumber').combobox2();
Fixed the problem.

Error on thr page jQuery(...).on is not a function

I am creating my first yii framework project. I am using cgridview in my project. When I load the page an error is showing in the console. The error is coming from a Javascript code generated by cgridview.
error is
TypeError: jQuery(...).on is not a function
jQuery(document).on('click','#items-grid a.delete',function(){
My javascript is
/*<![CDATA[*/
jQuery(function($) {
jQuery(document).on('click','#items-grid a.delete',function(){
confirmDelete(this);
return false;
});
jQuery('#items-grid').yiiGridView({'ajaxUpdate':['menuitems- grid'],'ajaxVar':'ajax','pagerClass':'pager','loadingClass':'grid-view-loading','filterClass':'filters','tableClass':'items','selectableRows':1,'enableHistory':false,'updateSelector':'{page}, {sort}','filterSelector':'{filter}','pageVar':'items_page'});
});
/*]]>*/
What Kind of issue this is. I have included jquery.js latest vertion in my header. I tried older version also but this error is same. How should I fix this error?
You may need to disable Yii's build-in JQuery and use your own version of JQuery. To disable Yii's built-in JQuery put the following lines into your view and load your own JQuery with avoiding conflicts:
Yii::app()->clientScript->scriptMap=array(
'jquery.js'=>false,
'jquery.ui.js' => false,
);

Telerik modal mvc Unable to get property 'scripts'

Using Telerik controls version 2012.1.214.340 with mvc 3. I want to open a modal window to an external page and thought it would be straight forward....but either it is not...or more likely I am not googling / reading the correct documentation.
I don't really want to load the content into a hidden div and then pop it modal later if the user chooses to do so.
I would prefer to just do it all in javascript / jquery and so my research led me to write this:
What I wrote thus far in javascript is:
var windowElement = $.telerik.window.create({
title: "Test Modal",
html: "<strong>Where am I</strong>",
contentUrl: 'http://www.google.com',
modal: true,
resizable: false,
draggable: true,
scrollable: false,
onClose: function () { }
});
cshtml razor is:
#(Html.Telerik().ScriptRegistrar()
.jQuery(false)
.jQueryValidation(false)
.DefaultGroup(grp => grp
.Add("telerik.window.min.js")
))
)
When I run the site I get this error on load of the page:
0x800a138f - JavaScript runtime error: Unable to get property 'scripts' of undefined or null reference
and the debugger is on this line in the telerik.window.min.js
b.scripts.push("telerik.window.js")
Based upon the line it broke on I went looking for telerik.window.js and didn't find it in the project...huh? The previous owner didn't include that one file?
So I went to google code and found this.
Created the file and added it as such and still I get the error...
So I think I am missing something else but not sure exactly what.
TIA
You shouldn't have to manually include a telerik JS file, they should be loaded automatically (as long as they are in a correct folder).Do you have a folder /Scripts/2012.1.214 with a lot of telerik.js file + jquery ?
Can you try again without adding that file to the DefaultGroup ?
But you'll have another problem, as I see you declare jQuery(false). Was it done on purpose ? Because if you set it to false, and don't declare another jQuery file in the DefaultGroup, nothing will work.
I had the same problem, doing this worked for me:
#(Html.Telerik().Window()
.Name("_placeholder")
.Visible(false)
)
Including somewhere on the page a static window that will never be used - telerik seems to only include scripts when an control of that type is used.

How do I Programmatically Enable/Disable Firebug Lite at Runtime?

How can I show or hide the entire Firebug panel and its icon at runtime ?
I browsed through Firebug.chrome but could not find anything appropriate.
I tried the following snippet which did not have any apparent effect, Firebug Lite was still there.
Firebug.extend(function (FBL) {
alert('TEST'); // This is run
FBL.Firebug.chrome.deactivate(); // No errors but nothing happens
});
The anonymous callback function is definitely invoked.
Quite an old post, but still popping on google search for such a question.
I'm not even sure which version of Firebug Lite you were using, but the following works well with 1.4.0 (once the page has loaded):
Firebug.chrome.open();
Firebug.chrome.close();
Firebug.chrome.toggle();
Firebug-Lite is enabled through the javascript function in the bookmark, and from there it just loads the javascript hosted at getfirebug.com.
If you control the website you're looking at, and want firebug to pop-up for that website, then you can add this to your code:
<script type="text/javascript">
function bookmarklet(F,i,r,e,b,u,g,L,I,T,E){
if(F.getElementById(b))
return;
E=F[i+'NS']&&F.documentElement.namespaceURI;
E=E?F[i+'NS'](E,'script'):F[i]('script');
E[r]('id',b);
E[r]('src',I+g+T);E[r](b,u);
(F[e]('head')[0]||F[e]('body')[0]).appendChild(E);
E=new Image;
E[r]('src',I+L);
}
$(document).ready(function() {
bookmarklet(document,'createElement','setAttribute',
'getElementsByTagName','FirebugLite','4','firebug-lite.js',
'releases/lite/latest/skin/xp/sprite.png','https://getfirebug.com/','#startOpened');
});
</script>
Or, did you mean that when you're browsing you always want Firebug / Firebug-Lite at the bottom?

Javascript Errors: "No relay set", only in IE 7, 8

My javascript won't load because of errors it receives, only in IE. I used debugger to get the following errors. This page renders the javascript correctly in Safari, FF and chrome but not in IE and only on specific pages like this.
http://tsqja.deznp.servertrust.com/Lakeside_721_2_Shelf_Heavy_Duty_Utility_Cart_p/lak-721.htm
1) No relay set (used as window.postMessage targetOrigin), cannot send cross-domain message
2) Invalid argument. jquery.min.js
Any ideas what the first error implies? I have switched out my jQuery build with the latest and it still does the same thing.
UPDATE I have updated my jquery.min.js to the latest and it I figured out this is where the page stops loading...after the invalid argument pops up in the jquery-latest.min.js, line 16 character 15511 which is the following letter 'b':
finally{b=[e,f],c=0}}return this}
DEMO https://so.lucafilosofi.com/javascript-errors-no-relay-set-only-in-ie-7-8/
1) - No relay set (used as window.postMessage targetOrigin), cannot send cross-domain message
is caused by the <g:plusone /> button on your site: ( google is busy of this notice )
the only way i found to circumnvent this issue is by doing something like this:
$(function() {
setTimeout(function() {
gapi.plusone.render("plusone-div");
},
1500);
});
2) - Invalid argument. jquery.min.js
looking into your source-code is a chaos! ;-) OMG
you have lot's of errors like ( missing http:// protocol specified ):
different folder case-name like /v/newsite/ and /v/Newsite/ this really matter if you are under nix but since you are using ASP...
code like this AttachEvent(window, 'load', store_init); while using jquery like jQuery(document).ready(function() {
multiple inclusion of the same file ( this file is included 3 times ) /a/j/product_details.js
massive use of $(function(){ & $(document).ready(function(){ & $(window).load(function(){ multiple times when just one needed;
js global's all around the page, at the top, in the middle and at the bottom, they should stay all on top IMHO...
different version of jquery loaded at same time like: jquery-1.4.4.min.js & jquery-1.6.2.js & 1.4.2/jquery.min.js together
minor but always crappy, you have <meta /> , <link /> and <script /> in mixed order just like a chicken salad, where they should stay in order meta, links and script preferably at the end of the page.
missing semi-colon ; all around;
non-sense/malformed code like below and much much more...
if (!/\/shoppingcart\.asp/i.test(window.location.pathname)) {
jQuery(document).ready(function() {
jQuery('a').each(AddCartLink)
});
}
var global_Config_EnableDisplayOptionProducts = 'False';
var global_ImageSeed = 'test.jpg';
global_ImageSeed = global_ImageSeed.substring(...
your site with no errors: https://so.lucafilosofi.com/javascript-errors-no-relay-set-only-in-ie-7-8/
what i have done is:
reordered main tags meta,links,script
removed shitty widgets like addthis, google, facebook
"tried" to place all the globals to the top;
commented the part of the code that cause chrome problems in the TopScriptsTEST5.js this file is your main problem, ( you should see an huge chunk of code commented )
removed duplicate file inclusion,
removed latest version of jquery, cause i strongly doubt that all the rest of your code work with the latest jquery version, so use the 1-4-4 instead
some other fix here and there... nothing special
hope this check-up help a little, but i think you need an exorcist ;-)

Categories