Customize contact form subject line

Sometimes you might want to add something to the beginning or end of your contact form subject line in order to create rules or filters in your email or help desk. Here's some sample code to add "Knowledge Base Request: "to the beginning of the subject lines. 


<script>
//add "Knowledge Base Request: " to subject line
$('.hg-contact-form-container  button[type=submit]').click(function(e){
e.preventDefault();
var subject = $('.hg-contact-form-container input[name=subject]').val();
$('.hg-contact-form-container input[name=subject]').val("Knowledge Base Request: " + subject)
$('.hg-contact-us-form form').submit();
});
</script>

This code can be placed into the bottom of Settings > Style > Custom HTML > Body directly or via a snippet.