can anybody help me in this code
For some reason when i click book list element it shows both forms(books and classes) instead of just book form as if ther开发者_运维知识库e is no break statement,i am really confused why is it doing that?
<html>
<head>
<script type="text/javascript">
$(document).ready( function(){
$('.hideshares').hide();
$('#shareupdate li').click(function(){
switch($(this).attr('id')){
case "book":
$('.hideshares').hide();
$('#bk').show();
break;
case "class":
$('.hideshares').hide();
$('#cs').show();
break;
}
});
});
</script>
</head>
<body>
<div>
<ul id="shareupdate" >
<li id="book" >Books</li>
<li id="class">classes</li>
</ul>
</div>
<div id="sharecontainer">
<form id="bk" class="hideshares">
<div id="bookneeds"><input type="radio" id="ndbook" value="needbk" name="books" />Need book
<input type="radio" id="pstbook" value="postbk" name="books" />Post book
</div>
</form>
<form id="cs" class="hideshares">
<div><label>class:</label> <input type="text" id="cls" size="10"/></div>
<div> <input type="radio" id="dntknw" name="dontknw"/>I don't know yet </div>
</form>
</div>
</body>
</html>
Made acouple of changes in appearance and function calling but your post pretty much worked for me without many problems; check out my Fiddle:
http://jsfiddle.net/sadmicrowave/FeBW9/
精彩评论