Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,252
    Thanks
    203
    Thanked 2,557 Times in 2,535 Posts

  • #3
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    [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 02:46 PM.

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,252
    Thanks
    203
    Thanked 2,557 Times in 2,535 Posts
    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 04:26 PM.

  • #5
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,202
    Thanks
    80
    Thanked 4,563 Times in 4,527 Posts
    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.

  • #7
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •