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

I am using jQuery to add a content editing attribute to a DIV.

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

When I click on it, I don’t get the focus effect that I get when I click on already content divs. It only focuses when I click it again.

This happens in each of my browsers - Safari 5, Chrome 18, Firefox 8. In any case, can I make it behave as it should?

+3
source share
3 answers

I realized that I have this problem because the element is also being dragged by jquery-ui and the click event was captured.

+5
source

http://jsfiddle.net/VV7BW/1/, , . $('div') , divs, , attr ( )

id, $('#id')

0

I had the same error that tried to add an attribute contenteditableto the mouse event. Using the event mousedowndoes not work. Using the event click, it works great ...

The attribute iddoes not change anything in my case.

0
source

All Articles