edit and drag

by ian_smithz

HTML

<div class="draggable">
Text to edit
</div>

<div class="draggable">
Text to edit
</div>

CSS

.draggable{
    background-color:#ccc;
    width:230px;
    height:400px;
}

JavaScript

$(".draggable")
    .draggable()
    .click(function(){
        if ( $(this).is('.ui-draggable-dragging') ) {
            return;
        }
        $(this).draggable( "option", "disabled", true );
        $(this).attr('contenteditable','true');
    })
    .blur(function(){
        $(this).draggable( 'option', 'disabled', false);
        $(this).attr('contenteditable','false');
    });