$(document).ready(function() {
$("#orderedlist li:first").hover(function() {
$(this).addClass("green");
}, function() {
$(this).removeClass("green");
});
});//目的:使所有表单重置
$(document).ready(function() {
$("#reset").click(function() {
$("form").each(function() {
this.reset();
});
});
});
$("#orderedlist li:first").hover(function() {
$(this).addClass("green");
}, function() {
$(this).removeClass("green");
});
});//目的:使所有表单重置
$(document).ready(function() {
$("#reset").click(function() {
$("form").each(function() {
this.reset();
});
});
});
$("form")取得的是所有form
$("form").each(function(){this.reset});就是所有form做reset操作,而reset是DOM元素form的方法
其实$("form")如果要转换成DOM对象用$("form")[0],意思是取得第一个form