I am running my App on Internet Explorer. There seems to be some issue with JQuery method:
$('.tooltip-demo').tooltip({
selector: "a[rel=tooltip]"
})
for which, i get the following error on the javascript console:
Object doesn't support property or method tooltip
What can be the cause of this error? please help.
There's no standard tooltip() function in jQuery, it's provided by a plugin. Ensure that you're a. loading the plugin and b. loading it after jQuery by placing the <script> tag for the plugin after the one for jQuery.
It looks like you're using a tool tip plugin for jQuery, but it hasn't been loaded when you make the call.
If this code is being run when the page loads, you should put it into a $(document).ready() function, to ensure that all the supporting libraries are loaded before it runs. This should solve the problem.
Related
I'm working on a Chrome extension that injects some scripts into Gmail, like jQuery and qtip. It worked without any problem until I added the Chrome extension LinkedIn Sales Navigator, which (I checked) is using jQuery too.
After adding it, I get this error:
TypeError: $(...).qtip is not a function(…)
And console.log($.qtip) returns undefined, while before adding this extension it was returning the function.
My flow to inject these scripts is:
In the manifest's "content_scripts" section I'm adding content.js.
In content.js file I'm using document.createElement("script") for each script and append it to the page's <head>.
I don't know what the problem is but I think it's an overwrite issue with jQuery but I'm not sure why nor how to solve it.
Thanks ahead for any help !
So, thanks to the comments I found out jQuery.noConflict(); existed, and have been able to check the availability of the wanted function and act accordingly :
if(!$.qtip)
jQuery.noConflict();
Hey guys out of no where I got this issue that came up on a wordpress site, no idea why. So let me tell you the issues:
Uncaught TypeError: Cannot read property 'msie' of undefined jquery.rating.pack.js:17 from jquery.rating.pack.js:17
Uncaught TypeError: Object [object Object] has no method 'live' from jquery.colorbox-min.js:4
So I have 2 plugins that stopped working because of this. I don't know if there was an update of some sort or where to even begin.
If you could give me a hand I would appreciate it.
Let me know if you need anything!
EDIT:
prodjsoundlighting.com - link to site with issue.
You have two jQuery scripts included on your website, you need to remove the one that is not from wordpress.
/wp-includes/js/jquery/jquery.js?ver=1.8.3
http://code.jquery.com/jquery-latest.min.js
What happens is all jQuery extensions (colorbox, rating pack) attach themselves on jquery object from first jquery script, then the second jquery script overwrites jquery object and you can't access any of the previously attached jquery extensions.
EDIT:
To avoid "$ is not a function" errors you will need to either replace all $ to jQuery
$(document).ready(function(){
will become
jQuery(document).ready(function(){
OR whats usually used, encapsulate your code with anonymous function like this:
(function($) {
// here goes your javascript code where you access jquery object will dollar sign
})(jQuery);
P.S. There is one quick fix you could use until you fix your code. Just use this in the same place where you had that other jquery call:
<script>var $ = jQuery;</script>
You should update to the latest version of Colorbox. Grab it here.
Old versions of Colorbox relied on .live(), which is a deprecated function (from 1.7+) and removed completely from jQuery 1.9+.
I'm working on a page that has both Mootools 1.4 and jQuery 1.5.1 running. I know this isn't ideal but I don't really have an option. The page works fine in most every browser, but not in IE8. I get the following error:
Object doesn't support this property or method
when attempting to add a click event, despite putting my jQuery-specific code in a noConflict block. Here's a fiddle that reproduces the issue: http://jsfiddle.net/p7rFV/1/
Thanks for any ideas on what's going on.
$.noConflict();
jQuery(document).ready(function($) {
// Code that uses jQuery's $ can follow here.
});
document.getElementById('button').addEvent('click', function(){
document.getElementById('tester').hide();
});
Two issues with your fiddle:
When you do, you should use jQuery.noConflict();, not $.noConflict();
MooTools can't enhance DOM elements at the prototype level in IE like it can in other browsers, so you have to always be sure to pass them through $() or document.id() before using MooTools-specific functions on them. So this line fails:
document.getElementById('tester').hide();
...because the DOM element has no hide method. Instead, just use $() or document.id():
$('tester').hide();
document.id('tester').hide();
...which will both look up the element and extend it.
Updated fiddle
I am using both IE and Firefox for testing. The Dojo addOnLoad works for both browsers BUT for Firefox, it fires before my Dojo TabContainer is initialised. For IE, it is working fine. Is there any other Dojo / Javascript / jQuery method to circumvent this problem?
Script
<script>
dojo.addOnLoad( function(){
alert("Tabcontainer loaded");
});
</script>
TabContainer
<div dojoType="dijit.layout.TabContainer" id="TabContainer">
I apologize, but I haven't used Dojo in over a year, so I've forgotten it all. Maybe try dojo.ready(), or you could try adding djconfig="parseOnLoad:true" to the <script> tag where you include the Dojo JS file. I have no idea if either of these methods will work, but it can't hurt to try :)
Edit: maybe a call to dojo.parser.parse(); in your onload handler will do the trick? (in conjunction with parseOnLoad:false?)
I have fixed it! This is done by including the first jsp page using the <%#include> This will definitely initialise the TabContainer so that future tabs can be added.
I am using jQuery javascript framework and whenever i load pages with firebug it returns "$" as an anonymous() function in console. Is there a way to fix it?
Thanks in advance.
Looks like jQuery was not loaded when you tried to call it. Try calling the object using jQuery instead of $ to confirm jQuery was actually loaded. Also, are you using other libraries like Prototype as well because they might be interfering with the $ object!! If yes, try using jQuery.noConflict().
I don't know why it happens, but yes I see it often too. Something about firebug interferes with the binding of the jQuery function to $ under some circumstance.
You're probably aware it's just the firebug console that's bugging out ( $() in included scripts should be working as expected), but it's worth mentioning. Usually I have to reload the page, or even kill the tab.
I'd like to understand why it happens, but for now when it happens (assuming jquery really is loaded in the page) I found I can fix it in the console with:
$ = jQuery;