User tests: Successful: Unsuccessful:
Fix to remove error TypeError: JQuery(...).tooltip is not a function, issue #4719
#4719
Installed Joomla v3.3.6 in localhost using XAMPP 1.8.2-5 and without any other component installed you can see an inline javascript file loaded in the head that is calling jQuery tooltip and popover. And that was causing the Error in Firebug Console.
I installed SmartSlider 2 component from http://www.nextendweb.com. I was wondering why their module disappears when I add a new module in any position. When I look at firebug console, I am getting "TypeError: JQuery(...).tooltip is not a function". That error stopped javascript to make nextendweb.com slider module to work.
jQuery tooltip and popover shouldn't be loaded or called when there is no use for it.
Fix is from nextendweb.com support (Gabor Racz):
This error is probably coming from this file: libraries/cms/html/bootstrap.php
Look for this code, it's probably at line 481.:
$script[] = "\t jQuery('" . $selector . "').tooltip(" . $options . ");";
change it to this:
$script[] = "\t if ( jQuery.isFunction(jQuery.fn.tooltip) ) jQuery('" . $selector . "').tooltip(" . $options . ");";
After changing line 481, I then got an error on popover, then around line 380.:
jQuery('" . $selector . "').popover(" . $options . ");
Change like 380 to:
if ( jQuery.isFunction(jQuery.fn.popover) ) jQuery('" . $selector . "').popover(" . $options . ");
The hack nextendweb.com provided worked, their slider module worked fine and I'm not seeing the javascript error anymore.
Labels |
Added:
?
|
Category | ⇒ | JavaScript |
Title |
|
||||||
Status | New | ⇒ | Pending | ||||
Rel_Number | 0 | ⇒ | 4719 | ||||
Relation Type | ⇒ | Pull Request for | |||||
Easy | No | ⇒ | Yes |
But it did it with sample data and no external extensions for me =\
I've installed Joomla 3.4.1 now, without demo data, a second time with demo data. There is no error.
I've installed staging package of today, without demo data, a second time with demo data. There is no error.
JQuery and Bootstrap loaded correctly. In all cases this line inside BODY
<a href="/" class="hasTooltip" title="Bla bla bla">Bla</a>
shows a bootstrap tooltip.
But it did it with sample data
Which sample data. There are several options while installing Joomla.
The only way I can get this error is to not load Bootstrap's JS. So there's a few possibilities, including:
Either way, I don't see how this can be an error with the core CMS.
As the original poster has described this problem is caused by the smartslider extension. The solution is NOT to modify the core of Joomla as nextweb suggest - the solution is to fix the code in their extension
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-05-24 09:52:08 |
Closed_By | ⇒ | brianteeman |
Have a look e.g. at line 362 of method popover() where JQuery and Bootstrap is loaded correctly
Thus it's guaranteed that function popover() exists, that it's loaded. I think it's your extension that is causing the error and the developers should fix their extension. I think it's loading JQuery not Joomla compliant a second time(?) and without any need.