Forums

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

Home Forums JavaScript Select all besides $(this) clicked

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #168000
    Anonymous
    Inactive

    Im manipulating many elements with the same class. I manipulate the $(this) element clicked in one way, and i want to manipulate the other ones that weren’t clicked in another way. How can i select all the elements with the same class besides the $(this) that was clicked?

    #168003
    Alen
    Participant

    I’m not exactly sure what you’re trying to do but this might help get you started: http://codepen.io/alenabdula/pen/qJKEg/

    #168008
    Paulie_D
    Member

    .not(this) doesn’t work?

    https://api.jquery.com/not/

    EG

    $("li").click(function () {
      $(this).toggleClass("active");
      $("li").not(this).removeClass("active");
    });
    
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.