A sample output using the two different tags is shown below. In order to open the link in a new window, the window.open
method is used.
Note: This method requires JavaScript to be enabled in your browser.
<form>
tagThe action
attribute in the <form>
tag can be used to specify the URL to send the form data to upon submission.
Note: Since
formaction
is an HTML5 specific feature, it may not always work as expected on older versions of popular browsers like Chrome and Safari. In some cases, a trailing question mark(?) is added at the end of the URL by default.
<a>
tagThe href
attribute can be used to add the link to a text and the <a>
tag can then be stylized with CSS to look like a button as shown below:
Free Resources