jQuery是javascript的一个常用框架,包含很多很方便的方法:
<script>
$document.ready(function(){
}
</script>
常用方法:.addClass .removeClass .prop .html .clone .parent .children .appendTo :nth-child()
常用属性:animated bounce text-primary fadeout hinge
<script>
$document.ready(function){
$(".button").addClass("animated");
$("#target1").clone().appendTo("left-well");
}
示例:获取 class 为target且索引为奇数的所有元素,并给他们添加 class。
$(".target:odd").addClass("animated shake");
记住,jQuery 里的索引是从 0 开始的,也就是说::odd 选择第 2、4、6 个元素,因为 target#2(索引为 1),target#4(索引为 3),target6(索引为 5。