使用jquery在图像上拖放文本



我是jquery的新手,我有以下代码,但拖放功能不起作用。文本正在按预期更新,但拖动不起作用。请帮助

$(document).ready(function(){
  $("#title").keyup(update);
});
function update(){        
  var title = $("#title").val();
  $("#Displaytitle").html(title);
  $("#Displaytitle").draggable();
  $("#Displaytitle").droppable({
    drop: function(event, ui) {
      var $text = $("#Displaytitle").text();
      $(this).addClass("ui-state-highlight").find("p").html($text);
      // $("#msg").hide();
    }
  });
}
<form>
  <input name="title" type="text" class="click" id="title" value=" " size="25" />
  <br/>
  <img  name="pic" class="click" id="photo" src="maritime.jpg" width="500" height="500" />
  <!-- </select> where is the opening tag ? -->
  <br/>
</form>
<!-- </div> where is the opening tag ? -->
<p id="Displaytitle"></p>

我在这里得到了答案。它超级酷而且简单。感谢每一位

最新更新