0

I need to add a link into these buttons:

<div class="buttons">
      <button class="action bluebtn"><span class="label">CREATE NEW ACCOUNT</span></button>
      <button class="action redbtn"><span class="label">EDIT ACCOUNT</span></button>
      <button class="action greenbtn"><span class="label">IMPORT EDI TEXT FILES</span></button>
      <button class="action"><span class="label">LOG OUT</span></button>
    </div>

Can somebody help me?

Edward
  • 95
  • 1
  • 1
  • 9

4 Answers4

4

You have several options here, depending on whether you can change the HTML:

If you can change the HTML make the buttons into a regular <a href="http://www....">link</a> or you can add an onclick event:

<button class="action bluebtn" onclick="javascript:document.location='some-url'">
    <span class="label">CREATE NEW ACCOUNT</span>
</button>

If you can't change the HTML, grab the buttons using something like jQuery and add the onclick event there:

$("button.bluebtn").click(function(){
    document.location = 'some-url';
    return false;
});

But I do recommend changing the buttons into regular links if you can. Having <button> elements acting as links makes no sense...

Reinder Wit
  • 6,490
  • 1
  • 25
  • 36
3

If you really need to use the <button> tag you can add the link with Javascript:

<button onclick="location.href='url_address'">Your HTML content</button> 

I think it would be more consistent thought to use <a> tags instead of <button>'s and then style them with CSS to look like the buttons. This way you rely on the default behavior of your markup and avoid having to use Javascript.

nienn
  • 2,130
  • 2
  • 15
  • 21
0
<input type="button" value="click for google" onClick="window.location='http://w­ ww.google.com' ">

or you may use

<button onclick="document.location.href='link';­ return false;">Link Text</button>
rOcKiNg RhO
  • 631
  • 1
  • 6
  • 16
-2

I think you just wrap the button with a href element like the following:

<div class="buttons">
  <a href="your link here"><button class="action bluebtn"><span class="label">CREATE NEW ACCOUNT</span></button></a>
</div>

and do same for rest of the buttons. Wrap them with "a href" tag.

Sahil
  • 1,959
  • 6
  • 24
  • 44