contenteditable不适用于可拖动功能

时间:2016-06-05 04:50:32

标签: jquery jquery-ui contenteditable resizable

在此代码中contenteditable无效,我在这里犯了什么错误? 我想在这个div中有多个contenteditable元素。

<!doctype html>
<html lang="en">
<head>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <style>
  #element { width: 150px; height: 150px; padding: 0.5em; }
  </style>
</head>
<body>


<div style="width:500px;height:500px;border:1px solid;"> 
    <div id="element" class="ui-widget-content">
      <p contenteditable='true' style="border:1px solid;">Drag me around</p>
    </div>
</div>


</body>
</html>

1 个答案:

答案 0 :(得分:1)

<!doctype html>
<html lang="en">
<head>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <style>
  #element { width: 150px; height: 150px; padding: 0.5em; }
  </style>
</head>
<body>


<div style="width:500px;height:500px;border:1px solid;"> 
    <div id="element" class="ui-widget-content">
      <p contenteditable='true' style="border:1px solid;">Drag me around</p>
    </div>
</div>


</body>
</html>