显示禁用按钮的弹出框

Show disabled button's popover

本文关键字:按钮 显示      更新时间:2023-09-26

我有一个使用twitter bootstrap js和css的表单。在我的表单中有两个按钮。一个按钮提交表单并将用户发送到某个地方。另一个按钮显示弹出对话框。

我需要第二个按钮不可点击但显示弹出框。

当我完全禁用按钮时,弹出框不显示,当我不禁用按钮时,它会转到表单的操作页面。我该如何解决这个问题?

http://jsfiddle.net/wnTUV/6/

<form class="well span3" action="/gosomeplace/" method="post">
    <div class="span3">
        <button type="submit" class="btn btn-info btn-large" href="gosomeplace/">
        <i class="icon-user icon-white"></i>
        Go now
    </button>
    </div>
    <div class="span3">
    <button class="btn disabled" rel="popover"
            title="Some title"
            data-content="Some content"
        >
        <i class="icon-question-sign"></i>
    </button>
        </div>

</form>

您是否尝试过使用onclick并返回false,或者这是否也会阻止弹出窗口?您需要保持按钮处于启用状态,但这应该会阻止它提交表单。

<button onclick="return false;" class="btn disabled" rel="popover"
        title="Some title"
        data-content="Some content">

如何防止按钮提交表单

您可以按范围添加换行按钮,并将style="display: inline-block;"添加到此范围。Folloging就是一个例子。

<span style="display: inline-block;" popover="XXX" popover-trigger="mouseenter">
<button class="disabled">确定</button>
</span>