"how to add dynamic Active class on selected page [closed]"
Bootstrap 4.1.1 Snippet by sunil8107

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery slide Left and Right Toggle Effect</title> </head> <body> <h1>I have a jQuery you can try on your live website and locar server</h1> <br> <p> $(document).ready(function($){<br> var url = window.location.href;<br> $('.sendit_navbar .navbar-nav li a[href="'+url+'"]').addClass('active');<br> }); </p> </body> </html>
h1{text-align:center;} p{margin:0 0 0 180px;}
$(document).ready(function($){ var url = window.location.href; $('.sendit_navbar .navbar-nav li a[href="'+url+'"]').addClass('active'); });

Related: See More


Questions / Comments: