jQuery编程练习
请教各位,代码错哪儿?
代码:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
<title>挑战题</title>
<style type="text/css">
.hide{
display:none;
}
</style>
</head>
<body>
<ul>
<li>1111</li>
<li>2222</li>
<li>3333</li>
<li>4444</li>
<li class="hide">5555</li>
<li class="hide">6666</li>
<li class="hide">7777</li>
<li class="hide">8888</li>
<li>9999</li>
</ul>
<a href="#" >更多</a>
<script language="javascript">
$(function(){
$("a").click((function(){
var content=$("a").text();
if(content=="更多")
{
$("a").text("简化");
$(".hide").css("display","list-item");
}
else{
$("a").text("更多");
$(".hide").css("display","none");
}
});
});
</script>
</body>
</html>