Draggable and Clickable input element using jquery

前端 未结 4 1037
抹茶落季
抹茶落季 2021-01-06 17:44

I have an input element inside a draggable div. My code should do the following things:

  • When I drag my input element, entire draggable div should be dragged. (
4条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-06 18:12

    You could try adding the contenteditable attribute to your div:

    HTML

    JQuery

    $(".draggable").draggable()
      .click(function() {
        $(this).draggable( {disabled: false});
    }).dblclick(function() {
        $(this).draggable({ disabled: true });
    });
    

    JSFiddle

提交回复
热议问题