Created
February 20, 2019 20:43
-
-
Save cosme12/1dd3d63aa47c77960fc8be241590dc18 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Email Form --> | |
<script> | |
$(document).ready(function() { | |
//Save references to elements. Don't do DOM walks in event handlers when not needed. | |
var $sendEmailEl = $('#send-email'); | |
var $subjectEl = $('#form-subject'); | |
var $bodyEl = $('#form-message'); | |
function updateEmailLink() { | |
$sendEmailEl.attr('href', 'mailto:contact@zane.sh?' + | |
'subject=' + encodeURIComponent($subjectEl.val()) + | |
'&body=' + encodeURIComponent($bodyEl.val())); | |
} | |
$('#send-email,#form-message').on('input', updateEmailLink); | |
updateEmailLink(); | |
}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form id="contact-form"> | |
<div class="form-group"> | |
<input type="text" name="form-subject" id="form-subject" class="form-input" placeholder="Asunto..." required=""> | |
</div> | |
<div class="form-group"> | |
<textarea class="form-input" name="form-message" id="form-message" placeholder="¿Cómo te puedo ayudar?" rows="5"></textarea> | |
</div> | |
<div class="text-center"> | |
<a href="" id="send-email" class="bttn-1" type="submit">Enviar Mensaje</a> | |
</div> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment