后发先至

导航

jquery基础知识随笔

<html>

<head>

<script type="text/javascript" src="/jquery/jquery.js"">

</script>

<script>

$(document).ready(function(){

$("button").click(function(){

$("p").hide();

});

});

</script>

</head>

<body>

<p>click the button ,i will disapper</p>

<button type="button">click </button>

</body>

</html>

第一个是js是加载jquery的库,一定要写,第二个js是实现这个功能的js,

功能为,点击click这个按钮,<p>这个页面元素的内容会隐藏.

$(document).ready(function(){});当页面加载完成后。
$("button").click(function(){});当button这个html页面元素被点击后。
$("p").hide();});选取html页面元素为<p>的这个元素,用hiden()函数改变他的属性为隐藏

posted on 2017-08-09 12:27  后发先至  阅读(220)  评论(0)    收藏  举报