I need to get the current nav clicked in my bootstrap menu, I know it has an "active" class added to the LI tag, but after looking a lot online and on the bootstrap site, Bootstrap does not seem to offer any JavaScript value containing the current nav...
anybody has an idea how to get this through a JavaScript function?
使用jQuery,你可以得到它:
var $activeItem = $('.nav .active');
FOUND IT! Leaving this here in case anybody else needs the info :
var currentView = $(".nav li.active > a").text();
(Note that you need to have scroll spy enabled)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.