4
Answers

Explain this query

Ankit  Shukla

Ankit Shukla

9y
1.1k
1
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)