我有一个使用twitter bootstrap js和css的表单。 在我的表格中有两个按钮。 一个按钮提交表单并将用户发送到某个地方。 另一个按钮显示一个弹出框对话框。
我需要第二个按钮不能点击但显示弹出窗口。
当我完全禁用按钮时,弹出窗口不显示, 当我不禁用按钮时,它会转到表单的操作页面。 我该如何解决这个问题?
<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>
答案 0 :(得分:2)
您是否尝试过使用onclick并返回false,或者是否也阻止了弹出窗口?您需要保持启用该按钮,但这应该阻止它提交表单。
<button onclick="return false;" class="btn disabled" rel="popover"
title="Some title"
data-content="Some content">
答案 1 :(得分:0)
您可以按一个范围添加包裹按钮,并将style="display: inline-block;"
添加到此范围。 Folloging就是一个例子。
<span style="display: inline-block;" popover="XXX" popover-trigger="mouseenter">
<button class="disabled">确定</button>
</span>