How can I enable 'draggable' on a element with contentEditable?

前端 未结 4 2083
刺人心
刺人心 2020-12-09 13:21

I\'d like to have a div that is at the same time editable and draggable, using jQuery UI. Content editability seems to work only if draggable is not enabled. Am I missing so

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-09 13:54

    It is working but the jQuery draggable is hijacking click event. You can still tab to it. This is a quick fix.

    $('#draggable').draggable().bind('click', function(){
      $(this).focus();
    })
    

提交回复
热议问题