数据切换标题重置不重置文本

data-toggle title reset not resetting text

本文关键字:置文本 标题 数据      更新时间:2023-09-26

我在div上设置一个工具提示,如下所示;(坦率地说,我不确定为什么要这样做,但我看到一个片段使用了这个,它的工作方式是我喜欢的)

 <div id="termsandconditions" class="col-xs-6" data-toggle="tooltip" title="Agree to the terms to enable the form">
        <a href="#modal-terms" data-toggle="modal" class="register-terms">Terms</a>
        <label class="switch switch-primary" >
            <input type="checkbox" id="register-terms" name="register-terms">
            <span></span>
        </label>
 </div>

更新这会产生一个样式的模态工具提示弹出,我想在点击事件中改变它的文本。我怀疑我无法更改文本与data-toggle属性有关。使用prop或attr会改变工具提示,但不会改变data-toggle设置的模态工具提示弹出框中的标题文本。

下面实际上添加了一个工具提示,但不改变原来的工具提示弹出

中的文本
  $("#termsandconditions").dialog("option", "title", "De-selecting terms will disable the form");
  $('#termsandconditions').prop('title', 'De-selecting terms will disable the form');
$('#termsandconditions').attr('data-original-title', 'De-selecting terms will disable the form');
$('#termsandconditions').attr('title', 'De-selecting terms will disable the form');