初次做项目遇到,编写的Java计时器不能运作,验证码函数也无法刷新。
打开浏览器,按下F12发现问题出现在
也就是没有连上jquery,解决方法:
添加依赖:
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>4.5.2</version>
</dependency>
`
并将html对应部分改成:
<script src="https://code.jquery.com/jquery-3.3.1.min.js" th:src="@{/webjars/jquery/3.5.1/jquery.js}" crossorigin="anonymous"></script>