# Tearing my hair out (what's left of it): turn button into link

**URL:** <https://forum.kirupa.com/t/tearing-my-hair-out-whats-left-of-it-turn-button-into-link/324537>\
**Category:** Uncategorized\
**Created:** [August 25, 2011, 10:46pm UTC](https://forum.kirupa.com/t/tearing-my-hair-out-whats-left-of-it-turn-button-into-link/324537 "2011-08-25T22:46:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eabigelow](https://avatars.discourse-cdn.com/v4/letter/e/eada6e/32.png) [@eabigelow](https://forum.kirupa.com/u/eabigelow)\
**Post date:** [August 25, 2011, 10:46pm UTC](https://forum.kirupa.com/t/tearing-my-hair-out-whats-left-of-it-turn-button-into-link/324537/1 "2011-08-25T22:46:02Z")

</div>

Hi–

I have this button in a HTML/PHP contact form:

\<input type=“submit” value=“Submit” /\>

Preceded by this script in the Head:

\<script type=“text/javascript”\>  
$(function(){  
$(’#contact-form’).submit(function(e){  
e.preventDefault();  
var form = $(this);  
var post\_url = form.attr(‘action’);  
var post\_data = form.serialize();  
$(’#loader’, form).html(’\<img src=“loader.gif” /\> Please Wait…’);  
$.ajax({  
type: ‘POST’,  
url: post\_url,  
data: post\_data,  
success: function(msg) {  
$(form).fadeOut(500, function(){  
form.html(msg).fadeIn();  
});  
}  
});  
});  
});  
\</script\>

That combination works to submit the contact form using a php file called process.php.

The problem is, I’d like to make that button into a LINK that does the exact same thing (my site doesn’t want a button there).

I have tried a javascript link, like so:

function submitform()  
{  
document.forms[“contact-form”].submit();  
}  
\</script\>

Followed by the js link:

\<a href=“javascript: submitform()”\>Submit This\</a\>

BUT this does not work to submit the form as the button does.

Is there any way to do this?

Many thanks for any help! I am ready to tear my hair out…
