【发布时间】:2012-10-29 23:30:35
【问题描述】:
我需要在禁用按钮上显示工具提示并在启用按钮上将其删除。目前,它是反向工作的。
扭转这种行为的最佳方法是什么?
$('[rel=tooltip]').tooltip();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<hr>
<button class="btn" disabled rel="tooltip" data-title="Dieser Link führt zu Google">button disabled</button>
<button class="btn" rel="tooltip" data-title="Dieser Link führt zu Google">button not disabled</button>
这是demo
P.S.:我想保留disabled 属性。
【问题讨论】:
-
需要禁用的按钮被禁用...
-
@EH_warch 我想让按钮保持禁用状态,但同时在点击事件上显示工具提示。
-
这对 OP 没有帮助,但未来的访问者可能会喜欢知道“只读”属性是相似的(尽管不相同)并且不会阻止鼠标悬停等用户事件。
标签: javascript jquery html twitter-bootstrap twitter-bootstrap-tooltip