前端Button点击无反应--记一次Debug经历
最近在学习秒杀系统,前端有个秒杀按钮,显示什么都正常,就是点击无反应,复制人家提供的源代码发现是表单的单词拼错了,form拼成了from,小细节。
<!--错误代码-->
<from id="secKillForm" method="post" action="/secKill/doSeckill">
<input type="hidden" name="goodsId" th:value="${goods.id}">
<button class="btn btn-primary btn-block" type="submit" id="buyButton">立即秒杀</button>
</from>
<!--正确代码-->
<form id="secKillForm" method="post" action="/secKill/doSeckill">
<input type="hidden" name="goodsId" th:value="${goods.id}">
<button class="btn btn-primary btn-block" type="submit" id="buyButton">立即秒杀</button>
</form>