springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-19 12:44:56
159
所以我有了这个表,并在表单元格中添加了一些按钮
<table border="1">
<tr>
<th><button id="0" class="mybtn" >1</button><div class="myDiv"></div></th>
<th><button id="1" class="mybtn">2</button><div class="myDiv"></div></th>
<th><button id="2" class="mybtn" >3</button><div class="myDiv"></div></th>
</tr>
</table>
当我单击按钮时,我希望它们添加一个文本字段。但是当我点击它时,这三个按钮同时工作。
以下是我的jQuery代码
<table border="1">
<tr>
<th><button id="0" class="mybtn" >1</button><div class="myDiv"></div></th>
<th><button id="1" class="mybtn">2</button><div class="myDiv"></div></th>
<th><button id="2" class="mybtn" >3</button><div class="myDiv"></div></th>
</tr>
</table>
如何使按钮独立工作?
顺晟科技:
嗯,您有3个div都具有类“mydiv”,所以如果单击任何按钮,代码都将在这3个div上执行:
要么使用IDs,要么选择父容器,然后使用jQuery$(this)和find()仅在父容器中搜索类为“mydiv”的div。
为每个按钮取同级元素
<table border="1">
<tr>
<th><button id="0" class="mybtn" >1</button><div class="myDiv"></div></th>
<th><button id="1" class="mybtn">2</button><div class="myDiv"></div></th>
<th><button id="2" class="mybtn" >3</button><div class="myDiv"></div></th>
</tr>
</table>
使用。
您所要做的就是使用
<table border="1">
<tr>
<th><button id="0" class="mybtn" >1</button><div class="myDiv"></div></th>
<th><button id="1" class="mybtn">2</button><div class="myDiv"></div></th>
<th><button id="2" class="mybtn" >3</button><div class="myDiv"></div></th>
</tr>
</table>
演示
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11