Jquery 引导表悬停类不工作

Jquery 引导表悬停类不工作,jquery,html,twitter-bootstrap,Jquery,Html,Twitter Bootstrap,想知道这是我的引导悬停类不工作的原因吗。由于我在页面加载时使用jquery填充数据的方式 这是我的表格 <table id="currency" class="table table-hover table-sm"> <thead class="thead-dark"> <tr> <th scope="col">Date</th> <th scope="col">JPY&

想知道这是我的引导悬停类不工作的原因吗。由于我在页面加载时使用jquery填充数据的方式

这是我的表格

 <table id="currency" class="table table-hover table-sm">
    <thead class="thead-dark">
      <tr>
        <th scope="col">Date</th>
        <th scope="col">JPY</th>
        <th scope="col">USD</th>
        <th scope="col">SGD</th>
        <th scope="col">AUD</th>
        <th scope="col">THB</th>
        <th scope="col">CNY</th>
        <th scope="col">TWD</th>
      </tr>
    </thead>
    <tbody>
    </tbody>
  </table>

日期
日元
美元
新加坡元
澳元
泰铢
人民币
TWD
在页面加载期间,我使用类似于express的东西填充数据

jQuery.get('/currency', function(dreams) {
console.log(dreams)
dreams.forEach(function(dream) {
  $('<tr>').appendTo("#currency>tbody");
  $('<td></td>').text(dream.date_time).appendTo('#currency>tbody');
  $('<td></td>').text(parseFloat(dream.jpy).toFixed(5)).appendTo('#currency>tbody');
  $('<td></td>').text(parseFloat(dream.usd).toFixed(2)).appendTo('#currency>tbody');
  $('<td></td>').text(parseFloat(dream.sgd).toFixed(2)).appendTo('#currency>tbody');
  $('<td></td>').text(parseFloat(dream.aud).toFixed(2)).appendTo('#currency>tbody');
  $('<td></td>').text(parseFloat(dream.thb).toFixed(3)).appendTo('#currency>tbody');
  $('<td></td>').text(parseFloat(dream.cny).toFixed(3)).appendTo('#currency>tbody');
  $('<td></td>').text(parseFloat(dream.twd).toFixed(3)).appendTo('#currency>tbody');
  $('</tr>').appendTo("#currency>tbody");
})
})
jQuery.get('/currency',函数(dreams){
console.log(梦)
梦。forEach(函数(梦){
$('')。附于(“#货币>正文”);
$(“”).text(dream.date\u time).appendTo(“#currency>tbody”);
$('').text(parseFloat(dream.jpy).toFixed(5)).appendTo('#currency>tbody');
$('').text(parseFloat(dream.usd).toFixed(2)).appendTo('#currency>tbody');
$('').text(parseFloat(dream.sgd).toFixed(2)).appendTo('#currency>tbody');
$('').text(parseFloat(dream.aud).toFixed(2)).appendTo('#currency>tbody');
$('').text(parseFloat(dream.thb).toFixed(3)).appendTo('#currency>tbody');
$('').text(parseFloat(dream.cny).toFixed(3)).appendTo('#currency>tbody');
$('').text(parseFloat(dream.twd).toFixed(3)).appendTo('#currency>tbody');
$('')。附于(“#货币>正文”);
})
})
这就是它不起作用的原因吗?

也许会对你有所帮助


您需要将
td
附加到
tr
tr
附加到
tbody
。您的代码将全部附加到
#currency>tbody

jQuery.get('/currency', function(dreams) {
    console.log(dreams)
    dreams.forEach(function(dream) {
      var tr = $('<tr>');
      $('<td></td>').text(dream.date_time).appendTo(tr);
      $('<td></td>').text(parseFloat(dream.jpy).toFixed(5)).appendTo(tr);
      $('<td></td>').text(parseFloat(dream.usd).toFixed(2)).appendTo(tr);
      $('<td></td>').text(parseFloat(dream.sgd).toFixed(2)).appendTo(tr);
      $('<td></td>').text(parseFloat(dream.aud).toFixed(2)).appendTo(tr);
      $('<td></td>').text(parseFloat(dream.thb).toFixed(3)).appendTo(tr);
      $('<td></td>').text(parseFloat(dream.cny).toFixed(3)).appendTo(tr);
      $('<td></td>').text(parseFloat(dream.twd).toFixed(3)).appendTo(tr);
      tr.appendTo($('#currency>tbody'));
    })
 })
jQuery.get('/currency',函数(dreams){
console.log(梦)
梦。forEach(函数(梦){
var tr=$('');
$('').text(dream.date\u time).appendTo(tr);
$('').text(parseFloat(dream.jpy).toFixed(5)).appendTo(tr);
$('').text(parseFloat(dream.usd).toFixed(2)).appendTo(tr);
$('').text(parseFloat(dream.sgd).toFixed(2)).appendTo(tr);
$('').text(parseFloat(dream.aud).toFixed(2)).appendTo(tr);
$('').text(parseFloat(dream.thb).toFixed(3)).appendTo(tr);
$('').text(parseFloat(dream.cny).toFixed(3)).appendTo(tr);
$('').text(parseFloat(dream.twd).toFixed(3)).appendTo(tr);
tr.appendTo($('货币>tbody');
})
})

控制台中的任何错误。因为你的代码用硬编码的值为我工作:-不,控制台中没有错误,非常感谢,现在对我工作,我做错了哪一部分?您需要将
td
附加到
tr
tr
附加到
tbody
。您的代码是全部附加到
#currency>tbody
@user1897151,您将
直接附加到
而不是