2012-11-20 72 views
0

工具提示不显示。只有通常显示在浏览器中的标题正在显示...我该怎么办?为什么不提示jquery在工作

这是我的代码。

HTML代码:

<form action="/validate.php" method="post" id="myform"> 
<table width="100%" border="1"><tr><td style="max-width:150px;"> 
<span id="l1" class="label">Username:</span></td><td 
    style="min-width:500px;"><input type="text" name="username" id="username" 

class="input" title="Username must contain only alphabets and numbers"/> 
</td></tr><tr><td> 
<span class="label" id="l2">Password:</span></td><td><input 

type="password" name="pass" id="pass" class="input"/> 
</td></tr><tr><td> 
<span class="label" id="l3">Repeat password:</span></td><td><input 

type="password" name="rep-pass" id="rep-pass" class="input"/> 
</td></tr></table> 
</form> 

的CSS:

.tooltip { 
    background-color:#000; 
    border:1px solid #fff; 
    padding:10px 15px; 
    width:200px; 
    display:none; 
    color:#fff; 
    text-align:left; 
    font-size:12px; 
    -moz-box-shadow:0 0 10px #000; 
    -webkit-box-shadow:0 0 10px #000; 
} 

的Jquery:

$(document).ready(function() { 
$("#myform :input").tooltip({ 
position: "center right", 
offset: [-2, 10], 
effect: "fade", 
opacity: 0.7 
}); 
}); 
+3

工具提示中添加新jQuery UI的1.9版本。你使用什么版本?是否有可能您有早期版本?只是一个猜测。 – War10ck

+0

@ War10ck版本1.8.2请勿使用此版本的此作品 –

+0

,这可能是您正在使用的jQuery的版本号。我使用相同的。 (最新的是1.8.3)。为了使用工具提示,你必须至少有1.9.0版本的jQuery UI。标准的jQuery库没有工具提示。它的UI库包括这些。你可以从[here](http://jqueryui.com/)下载它。 – War10ck

回答

0

尝试更新的jQuery UI库。我可能是错的,但是你的库是版本1.8.2应该是你的jQuery库。相当长一段时间以来,jQuery UI已经超过了这个数字。即便如此,你必须运行jQuery UI的版本1.9.0,以使用新的功能,如菜单,工具提示等

Download jQuery UI 1.9.0

-1

由于War10ck说,这是你正在使用的版本不存在。您可以选择更新它,也可以使用其他库。我是Twitter Bootstrap和它提供的工具提示的粉丝,只是我的两分钱:)。