更新时间:2023-12-02 23:14:10
现在我终于明白了你想要什么
Now I finnaly understand what you want
此代码是必需的
// Wait on the document to be loaded
$(function(){
// get every element with the class example in an array and loop
// through it(each) with i as index
$(".example").each(function(i){
// add class ex with the index
// this is the element we are pointing at so a div
$(this).addClass("ex" + i);
});
});
但是当您通过5个div遍历数组时,您可以在服务器端轻松做到这一点;)
but you could do this easily on server side when you loop through your array with 5 divs ;)