Header Ads

  • Breaking News

    How to create an HTML button that acts like a Link?

    Put it in a <form> wherein you specify the desired target URL in the action attribute.
    <form action="http://google.com">
        <input type="submit" value="Go to Google">
    <a class="btn" href="">Link</a>
    <button class="btn" type="submit">Button</button>
    <input class="btn" type="button" value="Input">
    <input class="btn" type="submit" value="Submit">

    Bootstrap (v2) sample appearance:

    <button onclick="location.href='http://www.example.com'">
    <a href="http://www.stackoverflow.com/">
        <button>click me</button>
    Edit 22-06-2013: This markup is no longer valid in HTML5 and will neither validate nor always work as potentially expected. Use another approach.

    <input TYPE="button" VALUE="Home Page"

    Try   It

    No comments

    Post Top Ad

    Post Bottom Ad