小编Ex-*_*-iT的帖子

如何设置限制:HTML中的每个循环

如何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,我该怎么做?

html javascript each loops thymeleaf

2
推荐指数
1
解决办法
5007
查看次数

jQuery find('img').attr('src')不起作用

以下代码不起作用:

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)

jquery

0
推荐指数
1
解决办法
2万
查看次数

标签 统计

each ×1

html ×1

javascript ×1

jquery ×1

loops ×1

thymeleaf ×1