如何each在thymeleafHTML页面中设置循环限制?
例如:
<select id="places" onchange="onPlaceChange();">
<option value="0">Select Place</option>
<option th:each="p:${places}" th:text="${p.place_Name}" th:value="${p.id}"></option>
</select>
Run Code Online (Sandbox Code Playgroud)
此代码循环遍历数据库中的项目,limit是列表的长度.
列表长度为14,我想将该限制设置为7,我该怎么做?
以下代码不起作用:
find('img').attr('src')
我希望将鼠标悬停在旁边区域并打开/关闭图像更改.
HTML
<aside style="width:200px;height:300px;text-align:center;">
<img class="img" src="imgs/photo_off.png" alt="" >
</aside>
Run Code Online (Sandbox Code Playgroud)
JavaScript的
$("aside").hover(
function () {
$(this).find('img').attr('src') = $(this).find('img').attr('src').replace("_off", "_on");
},
function () {
$(this).find('img').attr('src') = $(this).find('img').attr('src').replace("_on", "_off");
}
);
Run Code Online (Sandbox Code Playgroud)