基金会Zurb无法更改工具提示文本 [英] Foundation Zurb unable to change tooltip text

查看:111
本文介绍了基金会Zurb无法更改工具提示文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在工具提示文本已经设置后在运行时更改工具提示文本时出现问题。请参阅下面的更多信息。

I’m having a problem changing the tooltip text on runtime after the tooltip text has already been set. Please see below for more information.

请更正工具提示文字或解决下列问题的正确程式码。

Please can I have the correct code to change the tooltip text or a work around for the below problem?

作为一个例子,我创建了一个空白的html页面,有一个标签和两个按钮:

As an example I've created a blank html page, with one label, and 2 buttons:

<body>

<div class="row" style='padding-top:20px;'>
<div class="large-12 columns">
<label id='labelID'> my Tooltip label</label>

<input type='button' class='button' id='addFirstTooltip' value='Add First Tooltip'/>
<input type='button' class='button' id='changeTooltip' disabled value='Change Tooltip'/>
</div>
</div>

<script>
$(document).ready(function() 
{
  $(document).on('click', '[id^=addFirstTooltip]', function()
  {
     $('#labelID').attr('data-tooltip', '');
     $('#labelID').attr('title', 'My First tooltip text. This displays correctly.');

     $('#changeTooltip').removeAttr('disabled');
  });
  $(document).on('click', '[id^=changeTooltip]', function()
  {
     $('#labelID').attr('title', 'Now ive changed the tooltip text. Not displaying correctly.');
  });
});
</script>
</body>

好的,所以点击第一个按钮addFirstTooltip可以正确地添加基础工具提示。完全没问题。但是,一旦你改变工具提示文本(changeTooltip按钮),它基本上创建一个新的股票html工具提示与新的文本,并不改变原来的基础工具提示文本。

Okay so clicking the first button "addFirstTooltip" correctly adds the foundation tooltip. No problem at all. But as soon as you change the tooltip text ("changeTooltip" button), it basically creates an addition stock html tooltip with the new text, and does not change the original foundation tooltip text.

有人有解决方案吗?

推荐答案

Foundation.libs.tooltips.getTip($('#labelID')).remove();

在删除属性标题后调用该代码,并调用afftr('title','new tooltip text ') 之后!和繁荣!它工作!

Call that code after removing the attribute title, and call afftr('title', 'new tooltip text') after that! And boom! it works!

这篇关于基金会Zurb无法更改工具提示文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆