首先,对不起我的英语,我是一个巴西男孩,刚接触javascript,我尝试将id=terms
藏在网站中。
我就是不知道该怎么办了。
任何帮助都会有用
代码是这个
<div id="term">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</p>
<button id="accept" type="submit" name="accept">Accept the terms of this site</button>
</div>
<script>
$("#accept").click(function(){
$("#term").hide("fast");
});
</script>
最佳答案
您必须将链接添加到jQuery.js文件
<div id="term">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</p>
<button id="accept" type="submit" name="accept">Accept the terms of this site</button>
</div>
<script src="http://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
$("#accept").click(function(){
$("#term").hide("fast");
});
});
</script>