Dead links challenge should not mention jQuery
See original GitHub issueChallenge Make Dead Links using the Hash Symbol has an issue.
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2902.0 Safari/537.36
.
Old Issue Description:
Sometimes you want to add a elements to your website before you know where they will link.
This is also handy when you’re changing the behavior of a link using jQuery, which we’ll learn about later.
This is bad advice. You should avoid links that point to #
, unless you want a basic “go to the top” link. If you want to make something that is not pointing to another page, use a <button>
element instead. You can style that button to look like a link if you have to. But <a>
means “points to another page”.
(I’m not saying that giving some click handler to an <a>
is wrong in all cases, of course. Replacing an <a>
with something that loads the link without reloading (aka AJAX) is fine.)
Updated Description: New challenge title: Make Link Placeholders using the Hash Symbol
New description: When developing a website you often want to check the behavior and looks of a page before you connect it with the rest of the website. For example, You want to check how a link looks when clicked without it causing the browser to move to another page.
That’s where placeholder links come handy.
For <a>
element to be a link it must have href
attribute (otherwise it is rendered just like a normal text). There’s a tradition in developer community for creating placeholder links by assigning href
attribute to #
symbol.
#
symbol is actually a valid fragment identifier - a shorthand for the top of the page. So, when you’re not at the top of the page be warned that clicking on the placeholder link will move you back to the top.
code formatting removed by @abhisekp - 30th Nov. 2016 - 7:30 AM IST
Issue Analytics
- State:
- Created 7 years ago
- Comments:25 (20 by maintainers)
New challenge title: Make Link Placeholders using the Hash Symbol
New description: When developing a website you often want to check the behavior and looks of a page before you connect it with the rest of the website. For example, You want to check how a link looks when clicked without it causing the browser to move to another page.
That’s where placeholder links come handy. For
<a>
element to be a link it must havehref
attribute (otherwise it is rendered just like a normal text). There’s a tradition in developer community for creating placeholder links by assigninghref
attribute to#
symbol.#
symbol is actually a valid fragment identifier - a shorthand for the top of the page. So, when you’re not at the top of the page be warned that clicking on the placeholder link will move you back to the top.Is this a bad practise, yes sure it is. But at this point in the challenge the campers especially new campers are learning the basic concepts of the language.
Sure we can tell them that this should have been a button with some magic styling that looks like a link, but I am sire you would see how overwhelming that sounds for a beginner.
To my opinion we should be focused on getting the basics correct, and the best practices can chime in in actual projects when the core concepts are through for a camper.