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
chungyupan
1,866 Pointswhat is an anchor? what is it used for? the a in front of the click function
$("#imageGallery a").click(function(){})
1 Answer
Damien Watson
27,419 PointsAn anchor tag is generally used to link to a location in your page, a page in your website or another page on the web. Anchor tags can also be used create a link point in your page, alert mobiles to a phone number and open a blank email. I'm sure there might be a few more I can't think of at this hour.
<!-- General use: -->
<a href="#top"></a>
<a href="about.html"></a>
<a href="http://www.google.com"></a>
<!-- Other uses -->
<a name="jump_here"></a>
<a href="tel:5555 1234">5555 1234</a>
<a href="mailto:me@here.com">me@here.com</a>
The click function you are referring to above is jquery's way of adding a click function to an anchor or many anchors. This is similar to:
<a href="#" onclick="alert('hey there!');return false;">Hey!</a>
<!--
If you don't put in the 'return false;' the href='#' will
be called after the alert!
Note: If you leave the 'href' off, then you won't get
the hand when hovering.
-->
Hope this helps. :)
chungyupan
1,866 Pointschungyupan
1,866 Pointsyes it does help a lot thanks!!!