Skip to content
Sign upLog in
← Back to Community
When I use href in html, why doesn't it work?
Profile icon
CandySuperCool

I used href in html, but it doesn't work.

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
Profile icon
CandySuperCool
Comments
hotnewtop
Profile icon
Coder100

works for me. Make sure all your tags are closed and your HTML is valid.

Profile icon
CandySuperCool

I mean that I can't click on click here.

@Coder100

Profile icon
Coder100

@WilliamXing
Yes. You must open it on a new tab.

Profile icon
Coder100

or you could also add this to your a tag:

<a href="http://xkcd.com" title="xkcd: Land of geeky comics!" target="_blank">Click here</a>

@WilliamXing

Profile icon
tussiez

Solution

Your link works. However, it cannot redirect inside of the Repl (<iframe>), so you must open your website in a new tab.

Profile icon
xxpertHacker

Works for me, just make sure that it's opened into it's own tab.

Profile icon
RYANTADIPARTHI

hmm, that's weird, it should work. Try removing the title in that a link instead. see if it works.

Profile icon
19wintersp

Your <p> and <a> are inside of your <script> tag, because you didn't close it. Content of <script> tags is interpreted as JavaScript, rather than HTML. To fix this, add a </script> tag after your JavaScript code, after line 11.