CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   HTML & CSS (http://www.codingforums.com/forumdisplay.php?f=13)
-   -   focus remains on control despite focus changed (http://www.codingforums.com/showthread.php?t=283176)

BubikolRamios 11-29-2012 12:23 AM

focus remains on control despite focus changed
 
select text, click color change:
http://www-archive.mozilla.org/editor/midasdemo/

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.

felgall 11-29-2012 02:08 AM

being selected and having the focus are two entirely different things.

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

BubikolRamios 11-29-2012 08:25 AM

so, I have:
Code:

<div contentEditable ="true" ...
and selected text inside that.

Code:

  <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. ...


All times are GMT +1. The time now is 02:38 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.