Insert Page title into hidden form value with javascript/jquery?
I've got a form on every page of my site via a template but I'd like to have the page title included into the emails sent via the forms so开发者_如何学Go we know exactly which page the form was submitted from. Is there a simple way to do this with jquery?
Thanks for any tips/ideas.
Make a hidden element with HTML:
<input id="pageTitle" type="hidden" value="" />
Include this javascript on your page (requires jQuery):
$("input#pageTitle").val(document.title);
精彩评论