图标不显示

时间:2018-08-08 09:41:34

标签: javascript icons display

我正在尝试在文本后显示图标,例如开始(*),它将重新代表医疗服务提供商的仲裁。

    <tbody>                                                   
   @{  
 int i = 0;


foreach (var item in medProviders)
 {
     if (item.Arb==true) { 
<tr class="sortList" style="cursor:pointer" id="increment-@i" data-id="@item.Id" data-lat="@item.Latitude" data-long="@item.Longitude">
                                                                    <td>@item.Firstname 
br/>
<i class="fa fa-heart"></i>
</td>                                                                       
 <td id="distance-@i"></td>
<td id="duration-@i"></td>                                                                                                                                                                                                                                             
</tr>
 i++;
    }
      }
         }

</tbody>

类似的东西:

enter image description here

有帮助吗?

OnClick脚本

$(".town").click(function () {
    $.getJSON("/NfDocuments/LoadMedicalProviders", { town: $(this).attr('data-town') },
        function (data) {
            $('#medProviders').empty();
            var p = 0;
            $.each(data, function () {
                $("#medProviders").append("<tr class='sortList' style='cursor:pointer' id='increment-" + p + "' data-id='" + this.Id + "'  data-lat='" + this.Lat + "' data-long='" + this.Lon + "'><td>" + this.Title +" <span><i class='fa fa-heart'></i></span> </td><td id='distance-" + p + "'><br/></td><td id='duration-" + p + "'></td></tr>");

                p++;
            });
        });
});

1 个答案:

答案 0 :(得分:0)

  

看看点击功能

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"/>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>

</head>
<body>

<div class="container">
  <button type="button" class="btn btn-primary mybtn" data-toggle="modal" data-target="#myModal">
  Click To add Icon
  </button>

<table border="1" class="nytable">
    <th>Name</th>
    <th>Icon</th>
    <tr>
        <td>Blah</td>
        <td><i class="fa fa-heart"></i></td>
    </tr>
</table>
  
</div>
<script>
    $('.mybtn').click(function(){
       $('.nytable').append('<tr><td>Blah</td><td><i class="fa fa-heart"></i></td><tr>')
    });
   
</script>
</body>
</html>