Go Back   CodingForums.com > :: Client side development > JavaScript programming

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 12-05-2012, 11:13 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
execCommand clear all formating

sample text:

chfjgj ghj gfhj hg jgfh jfg foo sdčlfaklsd foo gfhdfhg

assuming blue stuff is something like:

Code:
<font color='blue'>foo</font>
or 
<font color='blue' id = 'dsfasd' ...>foo</font>
How to clear that (assuming I selected one of 'foo's), using execCommand or anything else to 'foo' only ?
__________________
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 12-05-2012, 02:12 PM   PM User | #2
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, in order to do something you must read selection underlying HTML.

One cross browser method is here: http://www.codingforums.com/archive/.../t-154848.html, scroll to bottom.

Now the problem that exist all the time, regardles of method used for reading
underlying HTML .....

consider this (note extra space in second line):

Code:
(<font color='blue'>foo</font>)
( <font color='blue'>foo</font> )
In first case selecting 'foo' and using func for reading HTML, return would be 'foo', in second case selecting ' foo ' (with spaces) return would be ' <font color='blue'>foo</font> ' (with spaces).

This(getting html) even work if you have 'foo,' and select all that, but gives you one extra unwanted ',' (in this case) inside HTML.

Any solution to this ?

All upper statements tested on FF.

EDIT: the prob is in contentEditable = /true/false. In IE works OK regardlesa of state, in FF works same as IE OK if false, otherwise not.
__________________
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; 12-05-2012 at 04:04 PM..
BubikolRamios is offline   Reply With Quote
Old 12-05-2012, 06:11 PM   PM User | #3
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,530
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Just a reminder that the <font> tag was deleted from HTML back in 1997 and was one of those replaced by CSS.
__________________
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 12-05-2012, 07:05 PM   PM User | #4
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
Yes I know, but execCommand puts it in. Latest FF version (for fore color text).
__________________
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
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 10:06 AM.


Advertisement
Log in to turn off these ads.