我有一些代碼在鏈接懸停時顯示消息。這是使用工具提示,最初在頁面加載它工作正常。當我單擊一個單選按鈕時,我的問題發生,這反過來將類tooltipbfile
的文本更改爲我想要的,但是當我單擊以更改文本時,它似乎已經失去了懸停功能。沒有工具提示顯示。我是否必須在某處啓用mouseenter事件。我看過像$(".tooltipbfile").prop('enabled', true);
這樣的代碼,但它沒有任何區別。啓用jQuery鼠標懸停事件
如果有人能夠向我展示在點擊事件後重新啓用鼠標事件的正確方法,我將不勝感激。謝謝
更新:根據tooltipster API。 $( 「tooltipbfile」)tooltipster( '禁用');
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');
}
});
});
Tooltipster代碼
正常工作在頁面加載
<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>
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>
爲你的問題做一個樣品小提琴演示 – Rex
你能發佈你的html嗎? – francadaval
@Rex試圖做一個小提琴,但沒有到tooltipster庫的外部鏈接。謝謝 – user1532468