Hey everybody I want to let you know that I have undertaken the grueling task of getting the heck away from WordPress. I was so sick of the problems and updates I had to do all the time. I am now using my ezbloo system and I am integrating all my old posts into the new system. It sucks, but in the end, I will save bundles of time. I needed to keep things simple and that is why I created ezbloo. I'll have more on this later for you guys after I am done with the total integration of my old posts here. So if you are looking for a post and need it faster, shoot me an email and I will make it a priority. [email protected]

To use a JavaScript button as a link properly you need to start off with an HTML button element. This is commonly referred to as the button tag in HTML. Below is the code example for a button element.

 <button></button>
If you put the button tag element in a webpage it will look like this.

Button Tag Element

Button Tag Element You will notice that it does not have any text associated with it. Put text in the button between the center carrots.

<button>Button</button>
This will give you a button that looks like this. Button Add Text

Button Add Text Now add a link element to the button like this.

<button onclick="window.location='http://www.website.com';">Button Link</button>

Another Method Using  A HTML Button Tag As A Link

You can use an onClick method with script tags to accomplish this task. See the codes below for JavaScript and jQuery.

OnClick Method With Script Tags

Use In Javascript
<!--script>
    function mylink(){
        window.location='http://www.website.com';
    }
</script !-->
<button onClick="mylink();">Button Link</button>
Use in jQuery
<button id="webLink">Visit Page Now</button>
<!--script>
$('#webLink').click(function() {
  window.location='http://www.website.com';
}); </script !-->
Use in Older jQuery
<button id="webLink">Visit Page Now</button>

$jquery('#webLink').click(function() {
  window.location='http://www.website.com';
});

Conclusion: Use A JavaScript Button As A Link Properly

There are many other things that you can do with the button tag element. The button tag is HTML however the action that we assign to the button is JavaScript. This should be used properly. This method is not good for SEO. Why? Because as it is described above it does not have SEO tags.  Use regular anchor links with SEO tags for search engines.