Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Banned
    Join Date
    Mar 2015
    Posts
    21
    Member #
    48461

    How to apply active selected class on list items?

    I tried to use this command but can not run:
    You try to change under this code:
    $("ul li a").on("click", function () {
    $(this).parents("ul").find("a").removeClass("activ e");

    $(this).addClass("active");

    return false;
    });

  2.  

  3. #2
    Senior Member sasha_bolcina's Avatar
    Join Date
    Sep 2014
    Location
    Serbia
    Posts
    274
    Member #
    40099
    Liked
    47 times
    Are you class "activ e" or "active"?

    if "active":

    Code:
    $("ul li a").on("click", function (event) {
        $(this).parents().find("a").removeClass("active");
        $(this).addClass("active");
        // why return false?
        // if you want to stop default a href action, put:
        event.preventDefault();
    });


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 07:36 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com