jquery $(#variable) 循环改变variable的值示例
jquery $(#variable) 循环改变variable的值示例,代码如下:
for(var p=1; p<=5; p++){
$("#properties"+p).show();
//下面有五个id为properties1 、properties2 、properties3 、properties4、properties5的p
//我们用一个语句就让下面五个p显示成功了。
}
}
<p class="banner" id="properties1">
<span>【${property1 }】</span>
<p id="property1" class="bannerchild"></p>
</p>
<p class="banner" id="properties2">
<span>【${property2 }】</span>
<p id="property2" class="bannerchild"></p>
</p>
<p class="banner" id="properties3">
<span>【${property3 }】</span>
<p id="property3" class="bannerchild"></p>
</p>
<p class="banner" id="properties4">
<span>【${property4 }】</span>
<p id="property4" class="bannerchild"></p>
</p>
<p class="banner" id="properties5">
<span>【${property5 }】</span>
<p id="property5" class="bannerchild"></p>
</p>