X-editable防止焦点输出框的默认行为关闭

时间:2022-10-19 00:09:24

How can I prevent the default behavior of closing the x-editable input box when the focus changed to something else?.

当焦点更改为其他内容时,如何防止关闭x-editable输入框的默认行为?

My requirement is to keep the input box open until a click on the tick or cross button happens.

我的要求是保持输入框打开,直到点击勾选或交叉按钮。

1 个解决方案

#1


4  

I believe you are looking for {onblur: "ignore"}.

我相信你正在寻找{onblur:“忽略”}。

From the documentation:

从文档:

Action when the user clicks outside the container. Can be cancel|submit|ignore.
Setting ignore allows having several containers open.

用户在容器外部单击时执行操作。可以取消|提交|忽略。设置忽略允许打开多个容器。

Please see this fiddle, or the below demo.

请看这个小提琴,或下面的演示。

$(function() {

  $.fn.editable.defaults.mode = 'inline';
  $('#publicname-change').editable({ onblur:"ignore"})

});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script>
<script src="http://vitalets.github.com/x-editable/assets/x-editable/bootstrap-editable/js/bootstrap-editable.js"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet"/>
<link href="http://vitalets.github.com/x-editable/assets/x-editable/bootstrap-editable/css/bootstrap-editable.css" rel="stylesheet"/>


<div class="control-group control-group-inline">
  <div class="controls">
    <a href="#" id="publicname-change" class="editable editable-click inline-input">Mr.Rohith</a>
  </div>
</div>

#1


4  

I believe you are looking for {onblur: "ignore"}.

我相信你正在寻找{onblur:“忽略”}。

From the documentation:

从文档:

Action when the user clicks outside the container. Can be cancel|submit|ignore.
Setting ignore allows having several containers open.

用户在容器外部单击时执行操作。可以取消|提交|忽略。设置忽略允许打开多个容器。

Please see this fiddle, or the below demo.

请看这个小提琴,或下面的演示。

$(function() {

  $.fn.editable.defaults.mode = 'inline';
  $('#publicname-change').editable({ onblur:"ignore"})

});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script>
<script src="http://vitalets.github.com/x-editable/assets/x-editable/bootstrap-editable/js/bootstrap-editable.js"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet"/>
<link href="http://vitalets.github.com/x-editable/assets/x-editable/bootstrap-editable/css/bootstrap-editable.css" rel="stylesheet"/>


<div class="control-group control-group-inline">
  <div class="controls">
    <a href="#" id="publicname-change" class="editable editable-click inline-input">Mr.Rohith</a>
  </div>
</div>