jQuery过滤选择器经典应用
本文实例为大家分享了经典的jQuery过滤选择器应用,供大家参考,具体内容如下
<!DOCTYPEhtml>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>过滤选择器</title>
<styletype="text/css">
#txt_show{display:none;color:#00C;}
#txt_hide{display:block;color:#F30;}
</style>
<scriptsrc="js/jquery-1.8.3.js"></script>
<scriptlanguage="JavaScript">
$(document).ready(function(){
$("[name=show]").click(function(){
$("p:hidden").show();
});
$("[name=hide]").click(function(){
$("p:visible").hide();
});
});
</script>
</head>
<body>
<pid="txt_hide">点击按钮,我会被隐藏哦~</p>
<pid="txt_show">隐藏的我,被显示了,嘿嘿^^</p>
<inputname="show"type="button"value="点击显示文字"/>
<inputname="hide"type="button"value="点击隐藏文字"/>
</body>
</html>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持毛票票。