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 08-01-2010, 06:50 PM   PM User | #1
domyski
New to the CF scene

 
Join Date: Aug 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
domyski is an unknown quantity at this point
Remove style from selected(highlighted) span/text in div

Hello,

I have tried on many forums, mayby here I will find answer.

I have many divs with spans inside(just like it is below-no extra ids,classes for spans:/).

Code:
[...]
<div>
<span style="color:red;">a</span>
<span style="color:blue;">b</span>
<span style="color:white;">c</span>
</div>
<div>
<span style="color:red;">d</span>
<span style="color:blue;">a</span>
<span style="color:white;">a</span>
</div>
[...]
What I would like to achieve: user selects with mouse "ab", click button(input type=button) which remove style from selected span/spans. Similar behavior like it is in TinyMCE.
domyski is offline   Reply With Quote
Old 08-02-2010, 07:24 AM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,103
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Double posted
http://stackoverflow.com/questions/3...an-text-in-div
Philip M is offline   Reply With Quote
Old 08-02-2010, 01:44 PM   PM User | #3
domyski
New to the CF scene

 
Join Date: Aug 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
domyski is an unknown quantity at this point
[ot]

Quote:
Originally Posted by Philip M View Post
Yes, but posted on the other site. Is it badly that I am looking answer in many places?

Last edited by domyski; 08-02-2010 at 01:46 PM..
domyski is offline   Reply With Quote
Old 08-02-2010, 03:15 PM   PM User | #4
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,103
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by domyski View Post
Yes, but posted on the other site. Is it badly that I am looking answer in many places?
Yes, it is badly. If you post in multiple forums you will find that you may not get an answer in any of them. People do not want to waste time answering a question when it has perhaps already been answered elsewhere.

There are few things in forums more irritating than taking the time to unsnarl someone's markup, javascript and css, figure out the fix, and post it only to find you've wasted your time because a duplicate post in another forum has already been answered.

This prohibition on cross-posting is a rule in almost every forum.

Last edited by Philip M; 08-02-2010 at 03:26 PM..
Philip M is offline   Reply With Quote
Old 08-02-2010, 09:27 PM   PM User | #5
domyski
New to the CF scene

 
Join Date: Aug 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
domyski is an unknown quantity at this point
[ot]

Quote:
Originally Posted by Philip M View Post
Yes, it is badly. If you post in multiple forums you will find that you may not get an answer in any of them. People do not want to waste time answering a question when it has perhaps already been answered elsewhere.
Ok. So, is there any time limit I have to wait, before I ask a question on other forum? Because without answer in one place, I look for other source of possible answers...
domyski is offline   Reply With Quote
Old 08-02-2010, 10:33 PM   PM User | #6
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,578
Thanks: 62
Thanked 4,063 Times in 4,032 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
I don't think the answers at StackOverflow address the question, really.

Each of those answers work if you click on *ONE* <span>, and they affect the clicked-on span.

But that's not what was asked for: He wants to be able to select ANY NUMBER of <span>s (that is, have them appear as selected...reverse video display, etc.) and *THEN* click on a button to have the styles *ALL* changed.

I think that's a much harder problem than the simplistic answers given in that other forum. I'm not sure there *is* an answer that works cross-browser.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Old 08-03-2010, 01:31 AM   PM User | #7
domyski
New to the CF scene

 
Join Date: Aug 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
domyski is an unknown quantity at this point
Quote:
Originally Posted by Old Pedant View Post
I don't think the answers at StackOverflow address the question, really.
Thank you Old Pedant! You are completely right - I am asking for solution for unanswered part. That is punchline I was heading to in discussion with Philip M.

Quote:
Originally Posted by Old Pedant View Post
I think that's a much harder problem than the simplistic answers given in that other forum. I'm not sure there *is* an answer that works cross-browser.
Thank you for your answer! In this case, I think that I have to rethink my project.
domyski 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 04:00 AM.


Advertisement
Log in to turn off these ads.