Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-29-2012, 12:23 AM   PM User | #1
BubikolRamios
Senior Coder

 
Join Date: Dec 2005
Location: Slovenia
Posts: 1,876
Thanks: 114
Thanked 76 Times in 76 Posts
BubikolRamios is on a distinguished road
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.
__________________
Found a flower or bug and don't know what it is ?
agrozoo.net galery
if you don't spot search button at once, there is search form:
agrozoo.net galery search
BubikolRamios is offline   Reply With Quote
Old 11-29-2012, 02:08 AM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,455
Thanks: 0
Thanked 498 Times in 490 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
being selected and having the focus are two entirely different things.

mytext.selected() is completely different from mytext.focus()
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 11-29-2012, 08:25 AM   PM User | #3
BubikolRamios
Senior Coder

 
Join Date: Dec 2005
Location: Slovenia
Posts: 1,876
Thanks: 114
Thanked 76 Times in 76 Posts
BubikolRamios is on a distinguished road
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. ...
__________________
Found a flower or bug and don't know what it is ?
agrozoo.net galery
if you don't spot search button at once, there is search form:
agrozoo.net galery search

Last edited by BubikolRamios; 11-29-2012 at 08:34 AM..
BubikolRamios is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:09 PM.


Advertisement
Log in to turn off these ads.