how to sho the active navigation ling using javascript

Solutions on MaxInterview for how to sho the active navigation ling using javascript by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "how to sho the active navigation ling using javascript"
Clovis
23 Aug 2016
1   <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2   <script>
3   $(document).ready(function() {
4
5            var CurrentUrl= document.URL;
6            var CurrentUrlEnd = CurrentUrl.split('/').filter(Boolean).pop();
7            console.log(CurrentUrlEnd);
8            $( "#lu-ID li a" ).each(function() {
9                  var ThisUrl = $(this).attr('href');
10                  var ThisUrlEnd = ThisUrl.split('/').filter(Boolean).pop();
11
12                  if(ThisUrlEnd == CurrentUrlEnd){
13                  $(this).closest('li').addClass('active')
14                  }
15            });
16
17   });
18