Ankit  Shukla

Ankit Shukla

  • NA
  • 681
  • 110.9k

Explain this query

Aug 19 2015 7:44 AM
Hi,
 
    Can anyone  explain this query?
 
 
<script>
$(function() {
var pgurl = window.location.href.substr(window.location.href.lastIndexOf("/") +1);
$(".menu li a").each(function() {
if ($(this).attr("href") == pgurl   || $(this).attr("href") == '')
$(this).addClass("active");
});

});
</script>
 
 and why we add  '1' in 3rd line (highlight with red color)?
 
 Thanks in advance. 
 

Answers (4)