2013-10-02 5 views
0

편집 가능한 텍스트 상자에 커서를 놓을 수 없습니다. 커서를 이동하거나 텍스트 블록을 클릭 할 때 프레임 DIV가 클릭을 잡기 때문일 수 있습니다. 나는 draggable가 그것과 관련이 있다고 생각하지만 확실하지는 않습니다.내 클릭이 내부 (contentEditable) div에 도달하는 방법?

모든 의견을 보내 주시면 감사하겠습니다.

여기 내 코드입니다 ("curObj"는 프레임, "inner"는 내가 편집 가능한 div입니다).

function textbox_editable() { 
    var curObj = window.curObj; 
    var inner = '#' + $(curObj).attr("id") + ' .object_inner'; 

    //unless the doubleclick was in a textbox that is already activated for editability... 
    if ($(inner).attr('contentEditable') != 'true') { 
     $(inner).attr('contentEditable',true); //set attribute editable 
     $(curobj).draggable("destroy");//remove draggable (it blocks the click-to-move-cursor functionality 
     $(curobj).resizable("destroy");//remove resizable (it blocks the click-to-move-cursor functionality 
     //make cursor text 
     $(inner).css("cursor", 'text'); 
     setEndOfContenteditable(inner) 
    } 
} 

//called when we are done editing the contents of a textbox 
function textbox_uneditable() { 

    $(".object_textbox .object_inner").removeAttr('contentEditable'); //remove editable attribute if it was present 
    $(".object_textbox").draggable(); //reinstate draggable 
    $(".object_textbox").resizable(); //reinstate draggable 
    //restore cursor 
    $(".object_textbox").css("cursor", 'move'); 
} 
+0

true/false를 설정하는 경우 attr 대신 prop()를 사용해야합니다. – Anton

답변

0

아 .. 오타입니다. 오타가 있습니다. curObj가 아닌 destroy-methods에 curobj가 있습니다. 이제 작동합니다. 단, setEndOfContenteditable은 작동하지 않지만 다른 문제입니다.