user7442152
user7442152

Reputation:

HTML <input> target link

I have a button on my screen using the code <input type="submit" value="Log In" class="LogInButton"> and I want when I click the button to take me to another page.

I have tried <input href="home.html" type="submit" value="Log In" class="LogInButton"> but that didn't seem to work.

Upvotes: 0

Views: 192

Answers (4)

Milche Patern
Milche Patern

Reputation: 20452

Have you considered replacing you <button> by an <anchor> ?

<a href="home.html" class="LogInButton">Log In</a>

Upvotes: 1

L. Vadim
L. Vadim

Reputation: 549

Simple use button:

<button onclick="location.href='http://yoursite.com'">Click ME</button>

Upvotes: 0

Michael Coker
Michael Coker

Reputation: 53674

You can use an onclick event and use location.href to change the URL

<input type="submit" value="Log In" class="LogInButton" onclick="location.href='home.html'">

Upvotes: 0

Ryan
Ryan

Reputation: 28187

Just add an action property to your form tag.

i.e. <form action="home.html" ...>

Upvotes: 2

Related Questions