Javascript 启用jQuery鼠标悬停事件

Javascript 启用jQuery鼠标悬停事件,javascript,jquery,tooltip,Javascript,Jquery,Tooltip,我有一些代码在链接悬停时显示消息。这是使用tooltipster,最初在页面加载时工作正常。我的问题发生在我单击单选按钮时,这反过来会将classtooltipbfile的文本更改为我想要的内容,但当我单击将文本更改回原处时,它似乎失去了悬停功能。不显示任何工具提示。我必须在某个地方启用鼠标事件吗。我看过类似于$(“.tooltipbfile”).prop('enabled',true)的代码但这没有任何区别 如果有人能告诉我在点击事件后重新启用鼠标事件的正确方法,我将不胜感激。谢谢 更新:根据

我有一些代码在链接悬停时显示消息。这是使用tooltipster,最初在页面加载时工作正常。我的问题发生在我单击单选按钮时,这反过来会将class
tooltipbfile
的文本更改为我想要的内容,但当我单击将文本更改回原处时,它似乎失去了悬停功能。不显示任何工具提示。我必须在某个地方启用鼠标事件吗。我看过类似于
$(“.tooltipbfile”).prop('enabled',true)的代码但这没有任何区别

如果有人能告诉我在点击事件后重新启用鼠标事件的正确方法,我将不胜感激。谢谢

更新:根据tooltipster API$(“.tooltipbfile”).tooltipster('disable')

jQuery代码

$(function() {
 $('input:radio').click(function(){
  if($(this).val()=='New Intake'){
     $("#fileref").hide();
     $(".maxbox").show();
     $("#INTKAddMoreFileBox").show();
     $(".tooltipbfile").text("Help");

  }else if($(this).val()=='New Intake Files'){
     $("#fileref").show();
     $(".maxbox").hide();
     $(".tooltipbfile").text("Some text here.").show();
     $("#INTKAddMoreFileBox").hide();
     $(".tooltipbfile").tooltipster('disable');
  }

});
});
工具提示代码

在页面加载时正常工作

<script type="text/javascript">
$(document).ready(function() {
            $('.tooltipbfile').tooltipster({
            theme: 'tooltipster-light',
            position: 'right',
            animation: 'fade',
            fixedWidth: 200,
            maxWidth: 290,
            content: $('<span>blah blah blah</span>')
            });
        });
</script>

$(文档).ready(函数(){
$('.tooltipbfile').tooltipster({
主题:“工具提示灯”,
位置:'右',
动画:“淡入淡出”,
固定宽度:200,
最大宽度:290,
内容:$(‘废话废话’)
});
});
HTML

相关部分

<div class="fieldset">
  <h1><span>Enter Box(es) Reference</span></h1>
  <p>
    <a href="#" id="INTKAddMoreFileBox" class="btn btn-info">Add More Boxes</a>
    <span class="maxbox" style="margin-left:10px;font-size:10px;color: grey;">( Maximum 8 )</span>
    <!--<div class="bxhelp">
      You now have the ability to input more than 1 box just by clicking the Add More boxes link. Please only enter 1 box reference per box. You can enter up to a maximum of 8 boxes.
      <a href="javascript:void(0)" class="boxhelpcls">Close</a>
      </div>-->
  <div id="INTKInputsWrapper">
    <p>
      <input name="box_add[]" type="text" required="required />
      <a href="javascript:void(0)" class="removeclass"></a>
      <a style="margin-left: 14px;" href="javascript:void(0)" class="tooltipbfile">Help</a>
    </p>
  </div>
  </p>
</div>
<div class="fieldset" id="fileref">
  <h1><span>Enter File References</span></h1>
  <p>
    <a href="javascript:void(0)" id="BFINTKAddMoreFile" class="btn btn-info">Add More Files</a>
    <span class="fmaxbox" style="margin-left:10px;font-size:10px;color: grey;">( Maximum 8 )</span>
    <!--<div class="fbxhelp">
      You now have the ability to input more than 1 file just by clicking the Add More files link. You can enter up to a maximum of 8 files.
      <a href="javascript:void(0)" class="fboxhelpcls">Close</a>
      </div>-->
  <div id="BFINTKInputsWrapper">
    <p>
      <input name="bfile_add[]" id="bfile_add[]" type="text" required="required" />
      <a href="javascript:void(0)" class="removeclass"></a>
      <a style="margin-left: 14px;" href="javascript:void(0)" class="fboxhelp">Help</a>
    </p>
  </div>
  </p>
</div>

输入参考框

(最多8个)


单击对象以将其转换回tooltipbfile后,只需对其重新调用tooltipster(),就像程序对document.ready所做的那样:

.tooltipster({
        theme: 'tooltipster-light',
        position: 'right',
        animation: 'fade',
        fixedWidth: 200,
        maxWidth: 290,
        content: $('<span>blah blah blah</span>')
        });
.tooltipster({
主题:“工具提示灯”,
位置:'右',
动画:“淡入淡出”,
固定宽度:200,
最大宽度:290,
内容:$(‘废话废话’)
});

我从未使用过tooltipster,但这应该可以使用。

为你的问题制作一个提琴示例演示你可以发布你的html吗?@Rex尝试制作提琴,但没有指向tooltipster库的外部链接。Thanks@francadaval完成。谢谢,我已经使用tooltipster在组件中更改文本进行了一些测试。什么都没有发生。是否有可能您正在更改页面组件,以使新组件不受插件的影响?我将把它放在哪里。它是否需要在“新摄入文件”的单击功能中,因为它已经在页面加载中。我不太确定我是否明白你的答案。ThanksFYI Tooltipster附带了一个禁用选项,如下所示:$(“.tooltipbfile”).Tooltipster('disable');也有效:-)我将在我的代码中发布。谢谢$(“.tooltipbfile”).text(“此处有一些文本”).show();-就在这之后