开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜