功能我有一個代碼代碼與參數
jQuery(function() {
jQuery(".class1").each(function() {
jQuery(".class2").hide("fast");
jQuery(this).children("input").click(
function() {
if (jQuery(this).parent().hasClass('class3')) {
jQuery(".class2").toggle("slow");
} else {
jQuery(".class2").hide("slow");
}
});
});
});
我怎樣才能改變它與參數的Class1,Class2中,CLASS3許多使用可重複使用的功能?
你需要學習如何做一個功能?我不明白 –
只是做一個函數並傳遞三個_class_作爲參數。 – TGrif
我試過做一些使用這樣的代碼就像一個函數:inputshow('class1','class2','class3'),其中'class1'等將是一個真實的類,例如,上面的代碼使用在許多案例。 –