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

标签 javascript jquery html

我在 dev.tsecashmere.com 上使用了以下代码,以便以前创建该网站的人获得工具提示悬停。

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

如何选择 <p> 下面的欢迎消息标签?或者我做错了什么?

提前致谢。

<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>

最佳答案

工具提示不起作用,因为 jQuery UI 需要标题属性,即使它是空的。您的 jQuery 代码选择 .welcome-msg元素很好,但工具提示本身没有应用。将 HTML 更改为此,它应该可以工作:

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

关于javascript - 如何选择 P 标签下方的类,Jquery 工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27161953/

相关文章:

javascript - 在 Kiosk 模式下检测 Google Chrome

php - 单击按钮逐步更改输入数字

html - 如何更流畅地动画化元素内背景渐变的旋转?

未找到 Javascript 函数,但在 html 中引用了该函数

javascript:匹配方法返回对象而不是数组

javascript - jQuery 用户界面 : Animate from right to left

Javascript 代理 : node-proxy, 和谐,混合对象与神奇的 getter 和 setter ......在 Coffeescript 中?

javascript - 如何在单击时更改全日历中的默认 View

jquery - 在 IE 上切换后,DIV(页脚)未被按下

javascript - 选择测验数量后显示测验