I am learning jquery, I want to make an effect: first click, slider down div # ccc and change the link class to 'aaa'; press again, highlight div # ccc and change the link class to "bbb". now the slider can work, but removeClass, addClass does not work. how to change so that two effective works are ideal? thank.
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
$("#click").click(function() {
$("#ccc").slideDown('fast').show();
$(this).removeClass('bbb').addClass('aaa');
});
$("#click").click(function() {
$("#ccc").slideDown('fast').hide();
$(this).removeClass('aaa').addClass('bbb');
});
});
</script>
<style>
#ccc{display:none;}
</style>
<div id="click" class="bbb">click</div>
<div id="ccc">hello world</div>
cj333 source
share