如何选择P标签以下的类,Jquery工具提示

时间:2014-11-27 02:02:49

标签: javascript jquery html

我在dev.tsecashmere.com上使用了以下代码,用于从先前创建该网站的人那里悬停工具提示。

但是,在tsecashmere.com的生产版本中,我似乎无法摆脱<p>标签,因此工具提示无效。

如何选择<p>标记下方的welcome-msg?或者我做错了什么?

提前致谢。

<p><a class="welcome-msg" href="#">FREE SHIPPING &amp; GUARANTEED HOLIDAY DELIVERY</a></p>
<script type="text/javascript">// <![CDATA[
$j(document).ready(function() {
    $j('.welcome-msg').tooltip({
            tooltipClass: 'blueTooltip',
            content: function() {
            return '\<div style\=\"text-align:left\"\>\*Free ground shipping offer valid on all online purchases from November 29, 2013 through January 5, 2014. Offer not valid at TSE or TSE Factory stores. Valid on shipments to addresses in the continental US only. Offer does not apply to previous purchases.The last days to ship and ensure your order will arrive on or before Wednesday, Dec. 25 will depend on the shipping method selected.\<br \/\>\<br \/\> Standard Ground (3 to 7 Business Days) - order on or before 12/16/13\<br \/\>\n2nd Business Day  - order on or before 12/19/13\<br \/\>\nNext Business Day  - order on or before 12/20/13\<br \/\>\<br \/\>Guaranteed Holiday Delivery is available for orders shipped to locations within the continental/contiguous 48 US states. Delivery has been guaranteed from the shipping carrier which indicates a 12/25/13 delivery date.\<\/div\>';    
}
    });
});
// ]]></script>

2 个答案:

答案 0 :(得分:0)

工具提示无效,因为jQuery UI需要title属性,即使它是空的。您的jQuery代码正在选择.welcome-msg元素,但工具提示本身未应用。将HTML更改为此,它应该可以工作:

<p><a class="welcome-msg" href="#" title="">FREE SHIPPING &amp; GUARANTEED HOLIDAY DELIVERY</a></p>

答案 1 :(得分:0)

在title =“/ * Your Message * /”属性中输入您的消息,而不是编写额外的功能。

它会显示您的信息。