$(function() { $('[data-toggle="tooltip"]').tooltip() }) $(document).ready(function() { var current_path =window.location.pathname; console.log(current_path); $('.sub_menu_tab ul li a[href="'+current_path+'"]').addClass('active'); });