getIndex()什么意思
getIndex()出自Jquey函数。 它的概述如下: 取得其中一个匹配的元素。num表示取得第几个匹配的元素。 这能够让你选择一个实际的DOM元素并且对他直接操作,而不是通过jQuery函数。$(this).get(0)与$(this)[0]等价。 参数: indexNumber取得第index个位置上的元素。
jQuery实现html表格动态添加新行的方法
jQuery实现动态添加行的方法
<script src="jquery-1.6.2.min.js"></script>
<script type="text/javascript">
<!-- jQuery Code will go underneath this -->
$(document).ready(function () {
// Code between here will only run when the document is ready
$("a[name=addRow]").click(function() {
// Code between here will only run
//when the a link is clicked and has a name of addRow
$("table#myTable tr:last").after('<tr><td>Row 4</td></tr>');
return false;
});
});
</script>
</head>
<body>
<table id="myTable">
<tr><td>Row 1</td></tr>
<tr><td>Row 2</td></tr>
<tr><td>Row 3</td></tr>
</table>
<a href="#" name="addRow">Add Row</a>
</body>
</html>
jquery实现多图片选中checkbox效果
$(document).ready(function() {
$(".img").click(function() {
if($(".checkbox").prop("checked")) {//先判断该checkbox是否已经被先中。
$(".checkbox").attr("checked","");
$(this).removeClass("check");//".check"这个是图片被激活后的样式。即该被点击的图片有两个状态,一个是正常,另一个是被激活后,写在两个样式里。
} else {
$(".checkbox").attr("checked","checked");
$(this).addClass("check");
}
})
})
JQuery记得用1.6后的版本。
.img 这个是被点击图片的样式
.check 这个是图片被点击过后的样式
.checkbox 这是那个checkbox的样式

