gpt4 book ai didi

javascript - 使用 Id 和 Bootstrap 样式解析表记录

转载 作者:行者123 更新时间:2023-12-01 01:31:02 25 4
gpt4 key购买 nike

在 id 和 bootstrap 格式周围应用引号是一项具有挑战性的工作。

html 段应如下所示:

<tr>
<th scope="row">1</th>
<td>HOU</td><td>-9.8</td>
<td id="odds-1">2</td>
<td id="place-bets-1">
<button class="btn btn-primary my-2 my-sm-0 pb" id="pick-team-1">Select</button>
</td>
</tr>

周围应该有引号

  • “行”
  • “赔率-1”
  • “投注-1”
  • “btn btn-primary my-2 my-sm-0 pb”
  • “选择团队1”

JS代码

$("#nflteams").append("<tr><th scope=row>" + i + "</th><td>" + response[i].HomeTeam + "</td><td>" + response[i].PointSpread + 
"</td><td id=odds-" + i + "1>2</td><td id=place-bets-" + i + "><button class=btn btn-primary my-2 my-sm-0 pb id=pick-team-" + i + ">Select</button></td></tr>")

我读到“\”字符串“\”应该有帮助,但是当我将其应用于 Id 和 Bootstrap 格式时,VSC 会抛出错误。

最佳答案

如果要在引号内使用引号,请在类和 ID 名称周围使用单引号

$('#sdf').append("<tr><th scope='row'>" + i + "</th><td>" + response[i].HomeTeam + "</td><td>" + response[i].PointSpread + "</td><td id='odds-" + i + "'>2</td><td id='place-bets-" + i + "'><button class='btn btn-primary my-2 my-sm-0 pb' id='pick-team-" + i + "'>Select</button></td></tr>")

关于javascript - 使用 Id 和 Bootstrap 样式解析表记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53274285/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com