Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript need to remove selected class

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #154115
    sbhambad
    Participant

    need to remove selected class. Below is my code

    .selected { color:red; }
    
    <div>
      <div>
        <ul>
          <li>
            <a>HOME</a>
          </li>
          <li>
            <a href="#">PLANS</a>
          </li>
          <li>
            <a href="#">FAQS</a>
          </li>
          <li>
            <a href="#">FEEDBACK</a>
          </li>
        </ul>
      </div>
    </div>
    
    <script type="text/javascript"> $(document).ready(function() {
    
    $('#menu .container ul li a').click(function() { $('.selected').removeClass('selected'); $(this).addClass('selected');
    
    });
    
    #154126
    __
    Participant

    Your code is not displaying well. You need to use code blocks (highlight your code, click on the [Block Code] button). A better solution would be to use a service like codepen.

    #154173
    sbhambad
    Participant

    sorry for the confusion guys.
    below is the code
    http://codepen.io/sbhambad/pen/DtLKa

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.