Let's look at the example.
Copy codeThe Code is as follows:
For (var p = 1; p <= 5; p ++ ){
$ ("# Properties" + p). show ();
// The following five div IDs are: properties1, properties2, properties3, properties4, and properties5
// We can use a statement to display the following five divs successfully.
}
}
<Div class = "banner" id = "properties1">
<Span> [$ {property1}] </span>
<Div id = "property1" class = "bannerchild"> </div>
</Div>
<Div class = "banner" id = "properties2">
<Span> [$ {property2}] </span>
<Div id = "property2" class = "bannerchild"> </div>
</Div>
<Div class = "banner" id = "properties3">
<Span> [$ {property3}] </span>
<Div id = "property3" class = "bannerchild"> </div>
</Div>
<Div class = "banner" id = "properties4">
<Span> [$ {property4}] </span>
<Div id = "property4" class = "bannerchild"> </div>
</Div>
<Div class = "banner" id = "properties5">
<Span> [$ {property5}] </span>
<Div id = "property5" class = "bannerchild"> </div>
</Div>