0
I have this mistake and I’ve tried everything, but nothing here the mistake:
jQuery.Deferred exception: $(...).tooltip is not a function TypeError: $(...).tooltip is not a function
at HTMLDocument.<anonymous> (http://askmee.tk/zero0:54:34)
at j (https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js:2:29999)
at k (https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js:2:30313)
undefined
r.Deferred.exceptionHook @ jquery.min.js:2
k @ jquery.min.js:2
setTimeout (async)
(anonymous) @ jquery.min.js:2
i @ jquery.min.js:2
fireWith @ jquery.min.js:2
fire @ jquery.min.js:2
i @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
S @ jquery.min.js:3
jquery.min.js:2 Uncaught TypeError: $(...).tooltip is not a function
at HTMLDocument.<anonymous> (zero0:54)
at j (jquery.min.js:2)
at k (jquery.min.js:2)
Code:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});
</script>
echo "<a data-id=\"{$answer['ask_hash']}\" data-toggle=\"tooltip\" title=\"Like\" onclick=\"like.add('{$to_id->login}','{$answer['ask_hash']}',false); return false;\" href=\"/{$to_id->login}/answer/{$answer['ask_hash']}/like\" class=\"ask-like $promt\"><i class=\"like\"></i></a>";
It seems that
tooltip
does not belong to jQuery or Bootstrap, so you need to include the file from this library as well.– Woss
Is using the jQuery-UI? Also, you opened the PHP tag (<?php) to use echo?
– UzumakiArtanis
@Andersoncarloswoss I picked up was on the website and showed the works all right.
– Megatorial
@Stormwind Yes put the (<?php) in echo I only cut code to simplify, jQuery there do not know if UI you can certify for min this link of the google itself that leads to it
– Megatorial
If it’s this
tooltip
what are you saying, it belongs to jQuery UI, so you need to include his library...– Woss
So you should know which jQuery you’re using :P. There are two tooltips, at http://api.jqueryui.com/tooltip/#entry-examples and https://jqueryui.com/tooltip/, which one are you using? @Megatorial
– UzumakiArtanis
Bootstrap has a
tooltip
like this, but in your case you are initiating an element that has not yet been loaded on your page, put the script below theecho
and testing– Dobrychtop