Ashley Davies
Ashley Davies

Reputation: 1893

Javascript not including jQuery plugin?

I'm using this line of code to include a plugin by FlowPlayer.org.

<script type="text/javacript" src="http://cdn.jquerytools.org/1.2.6/jquery.tools.min.js"></script>

However, it's not working; the following says undefined:

alert(jQuery().tooltip);

jQuery is included.

Anyone have any idea why?

Upvotes: 2

Views: 153

Answers (4)

v42
v42

Reputation: 1425

You typed javacript on your declaration. Also, tooltip is a plugin:

http://docs.jquery.com/Plugins/Tooltip

Download it here: http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/

Anyway, a good way to check if your jQuery call is ok is to run console.log(jQuery); on your console to check if the result is valid.

Also, you can use this kind of approach to prevent errors:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="local/path/to/jquery-1.6.1.min.js"><\/script>')</script>

Upvotes: 1

GG.
GG.

Reputation: 21854

You need jQuery library:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script type="text/javascript" src="http://cdn.jquerytools.org/1.2.6/jquery.tools.min.js"></script>

EDIT: And if you type alert(jQuery().tooltip()); instead of alert(jQuery().tooltip); ?

Upvotes: 1

Dennis
Dennis

Reputation: 32598

"text/javacript" is not a valid value for type so the browser ignores the script. You need "text/javascript" or better yet, just omit the type attribute entirely.

Upvotes: 4

Tomas Voracek
Tomas Voracek

Reputation: 5914

You must include jQuery before using plugins. Also, you must call tooltip() on some element, check demos http://flowplayer.org/tools/demos/tooltip/index.html

Upvotes: 1

Related Questions