Jquery工作常用实例——隐藏功能实现

隐藏功能的实现:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script type="text/javascript" src="jquery-1.6.1.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $("#button1").click(function(){
            $(this).hide();
        })
       
        $("p").click(function(){
            $(this).hide();
        })
    })
</script>
<title>Jquery hide</title>
</head>

<body>
<p>If you click me,I'll disappear!</p>
<input type="button" id="button1"  value="Click me"/>
</body>

</html>

如上,引入Jquery库后,单击Click me,该按纽即将隐藏;单击“If you click me,I'll disappear!”段落中的随便一个字,该段落将隐藏。


你可能感兴趣的:(Jquery工作常用实例)