? Success
Pull Request for # 4719

User tests: Successful: Unsuccessful:

avatar shadow-kun
shadow-kun
23 May 2015

Fix to remove error TypeError: JQuery(...).tooltip is not a function, issue #4719
#4719


Steps to reproduce the issue

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.

Expected result

jQuery tooltip and popover shouldn't be loaded or called when there is no use for it.

Actual result

screen shot 2014-10-16 at 22 41 30

System information (as much as possible)

Additional comments

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.

avatar shadow-kun shadow-kun - open - 23 May 2015
avatar zero-24 zero-24 - change - 23 May 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 23 May 2015
Category JavaScript
avatar zero-24 zero-24 - change - 23 May 2015
The description was changed
Title
Update bootstrap.php
Fix: jQuery Tooltip script error TypeError: JQuery(...).tooltip is not a function #4719
Status New Pending
Rel_Number 0 4719
Relation Type Pull Request for
Easy No Yes
avatar bertmert
bertmert - comment - 24 May 2015

Have a look e.g. at line 362 of method popover() where JQuery and Bootstrap is loaded correctly

static::framework();

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.

avatar shadow-kun
shadow-kun - comment - 24 May 2015

But it did it with sample data and no external extensions for me =\

avatar bertmert
bertmert - comment - 24 May 2015

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.

avatar bertmert
bertmert - comment - 24 May 2015

But it did it with sample data
Which sample data. There are several options while installing Joomla.

avatar mbabker
mbabker - comment - 24 May 2015

The only way I can get this error is to not load Bootstrap's JS. So there's a few possibilities, including:

  • A template using an unset trick to unload the Bootstrap media file
  • A template overriding the default Bootstrap JS file and not including the tooltip plugin within it
  • The Bootstrap JS being loaded somehow after the tooltip snippet

Either way, I don't see how this can be an error with the core CMS.

avatar brianteeman
brianteeman - comment - 24 May 2015

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


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7016.

avatar brianteeman brianteeman - change - 24 May 2015
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2015-05-24 09:52:08
Closed_By brianteeman
avatar brianteeman brianteeman - close - 24 May 2015

Add a Comment

Login with GitHub to post a comment