关于javascript:在使用或单击输入时不允许拖动

do not allow to drag when input is in use or clicked

本问题已经有最佳答案,请猛点这里访问。

我不想在输入时拖动div。

例如:当我在输入中包含一些文本并尝试突出显示它时,它不会突出显示;而是拖动div

https://jsfiddle.net/213r38rL/

1
2
  SELECT
  <input type="text" name="select" id="selectinput">


您可以在focusfocusout事件中设置draggable=false

1
2
  SELECT
  <input onfocus="document.getElementById('select1').draggable=false;" onfocusout="document.getElementById('select1').draggable=true;" type="text" name="select" id="selectinput">