【发布时间】:2018-05-11 11:29:09
【问题描述】:
我需要帮助更改标题中的文本内容。用户在第一页输入名称,它应该将下一页上的 h2 更改为键入的任何内容。任何帮助将不胜感激,是的,我添加了 Cookie.js 库。 这是我目前所拥有的:
入口页面:
<form action="Lab12-p2.html" method="post">
<h3>Enter Name </h3>
<label for="name">Username: </label>
<input id="name" type="text" name="name" />
<input id="submit2" type="submit" value="Submit" />
</form>
第 2 页:
<h2 id ="username"> Hi there! </h2>
Javascript:
$("#name").blur(function(event) {
var test = event.target.value;
Cookie.set("content", test);
var ger = Cookie.get("content");
$("#username").html("Hi" + content);
});
【问题讨论】:
标签: javascript jquery html css cookies