View Full Version : focus remains on control despite focus changed

11-29-2012, 01:23 AM
select text, click color change:

How is that done, that is, the focus is transfered elsewhere (color picker), but text still remains selected. How does that work ?

Need to do the same without iframes.

11-29-2012, 03:08 AM
being selected and having the focus are two entirely different things.

mytext.selected() is completely different from mytext.focus()

11-29-2012, 09:25 AM
so, I have:

<div contentEditable ="true" ...

and selected text inside that.

<img src = '...' onclick = "document.execCommand('underline')" />

Clicking there works, the text inside div stays selected and becomes underlined;

I have span, onclick it produces js generated color picker. And at that moment (clicking) text get deselected. Way around that ?

Edit: If I replace span with img, selected text is not deselected ! But unfortunately it gets deselected, selecting color in color picker. ...