Hi i came accross a piece of code as follows. <a href="#">Wedding Wishes Registry</a> . How <a href="#"> will work. when i tap on the link it is taking me to new page. How is that possible as there was no target page mentioned in 'href'.

JohnoLFC
—
2013-04-03T12:27:55Z —
#2

Hey agkrishna and welcome to the Forum.

The <a href="#"> is how you would place a link using HTML. If the end user clicks on the text, in this case "Wedding Wishes Registry", they would be directed to the place that the href has specified. In this case, the user wouldn't be directed as "#" is what you use when building a site before applying links.

As you have said this does re-direct you, can you provide the website so we can take a look?

Cheers

ralphm
—
2013-04-03T12:52:01Z —
#3

agkrishna said:

How <a href="#"> will work.

Yes, all that will do is take you to the top of the current page, so it's useless. The # needs to be replaced by the URL of the target page. # can also be used to link to other parts of the same page, but it doesn't sound like this is the purpose here.

Michael_Morris1
—
2013-04-03T12:59:08Z —
#4

Until a link is actually made programmers will sometimes put the # in as a placeholder. It's possible the placeholder escaped to the wild. Also, it is possible they have some JS click event to send you to the real link - but that's a clumsy way to do it since it breaks if JS isn't available.

is called an anchor (or hash...). so the link is pointing to an anchor or ID on a page, or it would be if the # had some text after it. As it stands it goes nowhere because it doesn't have text after it.

In case you are wondering WHY a link would go nowhere, they are probably using "#" as a placeholder. An anchor tag would not behave as an anchor tag w/o the HREF, but setting an actual HREF might send you off the page each time you are testing. That is annoying, so "href='#'" works out nicely.

Addition tips. you can actually use # to jump to a specific part of ANOTHER page. for example let say somewhere in you "about.html" page you have an element with an ID= "theresMore". From any OTHER PAGE, you can link directly to that part of the page with "href=about.html#theresMore" ( do note that would be a relative url just for the example)

hope that helps

ralphm
—
2013-04-03T23:30:56Z —
#7

agkrishna said:

Hi, the website is ...

But where is the link with the # in it? All I can see is this:

<a href="/kohlsStore/ourbrands/lclaurenconrad.jsp#">

The # at the end of that link is a mistake.

system
—
2013-04-24T05:46:24Z —
#8

It means "Render a hyperlink that takes the visitor to the top of the page and label it with the, distinctly uninformative, text Click here"It work :- <a href="submit.php"><input type="button" value="Submit" class="button" /></a>

Stomme_poes
—
2013-04-26T20:09:36Z —
#9

The above code (<a href="wherever"><input type="button"></a>) will not work in IE 6-8, unless someone's given the anchor an onclick event.

system
—
2013-05-02T12:21:16Z —
#10

agkrishna said:

Hi i came accross a piece of code as follows. <a href="#">Wedding Wishes Registry</a> . How <a href="#"> will work. when i tap on the link it is taking me to new page. How is that possible as there was no target page mentioned in 'href'.

when you linking within the same document, the A element is set as follows.

Eg: <a name="top"></a>

Now make a hyperlink that points to the bookmark:

Code

<a href="#top">Top of Page</a>

Output

Top of Page

<snip>

ralphm
—
2013-05-02T13:16:18Z —
#11

albert_mendosa said:

when you linking within the same document, the A element is set as follows.