Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

isFunction() always false in jQuery

Tags:

jquery

so I'm using qtip for a super simple tool tip implementation.

I'm not including qtip on every page, only the pages that needed, so I'm trying to check for qtip's existence before calling it.

 /*
  * Tool Tip
  * inits qtip on any link with class="tt"
  */
  if( $.isFunction( $.qtip ) ){
  $(".tt").qtip();
  }

I've no idea what this isn't working. it's always returning false. Any ideas? Thx.

like image 616
CreativeNotice Avatar asked Dec 13 '22 00:12

CreativeNotice


2 Answers

IMO, you should check

if($.isFunction($.fn.qtip))
like image 169
Rafael Avatar answered Dec 15 '22 14:12

Rafael


try this:

if( $.isFunction( $.fn.qtip ) ){
    $(".tt").qtip();
}

as plugins reside in the $.fn object

like image 38
Juraj Blahunka Avatar answered Dec 15 '22 14:12

Juraj Blahunka