简体   繁体   中英

bootstrap jquery. How to get the nav name

I need to get the name of a bootstrap nav when I click it using jquery or javascript. That is all, is a simple question.

I'm not sure what you mean by name but try the following code :

$('.navbar-nav').on('click', 'a', function(){
    $(this).text(); //To get the display text
    $(this).attr('name'); //if you mean attribute name
});

Hope this helps.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM