Search code examples
javascriptjqueryhtmlcontenteditable

DIV with added contenteditable="true" does not focus on click


I'm using jQuery to add the content editable attribute to a DIV.

$('div').attr('contenteditable', 'true');

When I click it, I don't get the focus effect I get when I click on already contenteditable DIVs. It only focus when I click it another time.

This happens in every single one of my browsers – Safari 5, Chrome 18, Firefox 8. Is there anyway I can make it behave as it should?


Solution

  • I realized I'm having this problem because the element is also a jquery-ui draggable and the click event has been hijacked.