Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Framework Basics Prototyping with Bootstrap Adding a Dropdown Menu and Glyphicons

Data-target vs href in Bootstrap dropdown menus?

Instead of using "href", for a sister-page, Guil uses "data-target" for the dropdown. Is this a best practice ONLY in Bootstrap dropdown menus, or is this something that we should use elsewhere?

2 Answers

Hi Alison :)

The "data-target" attribute is a custom HTML data attribute used by bootstrap, it can help take the use of specific classes and ID's away from your JS.

I had a read of this a while back when I first came across them myself :) here is the link

They are really handy and pretty damn robust to!

Hope this helps Craig

So, it's really only to be used when using Bootstrap?

Thanks, I'll take a look at the info.

Leigh Maher
Leigh Maher
21,830 Points

When I remove the href from this link, and you rollover the link, the hand icon disappears and you can only see the crosshair. Should we keep the href in here?