springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2021-09-15 13:18:05
245
这为什么不打印出span的文本“apple”?
<label class="search-recipe-chkbox fruitLabel">
<input type="checkbox" class="checkbox check-box-mob-filters check-box-desktop" id="12DSKT" name="Apple" value="12">
<span class="checkmark"></span>
<span class="ingredient-label">Apple <span class="recipe-count" id="12numDSKT">(1)</span></span>
</label>
for (var checkbox of checkboxes) {
if (checkbox.checked == true) {
console.log($(checkbox.id).siblings('.ingredient-label').text());
}
}
checkboxes
只是表单中的所有复选框(输入),并且假定选中了Apple。
谢谢
顺晟科技:
可能发生这种情况的原因有多种,但下面是我对您的问题的解决方案。
for (var checkbox of checkboxes) {
if (checkbox.checked) {
var val = checkbox.parentElement.querySelector('.ingredient-label').textContent;
console.log(val);
}
}
检查console.log
console.log
-
它需要在前面有一个#
for (var checkbox of checkboxes) {
if (checkbox.checked == true) {
console.log($('#'+checkbox.id).siblings('.ingredient-label').text()); // like this
}
}
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11