Py学习  »  Jquery

使用jQuery修改类列表

Ilyinsky Ivan • 5 年前 • 1341 次点击  

我无法更改表行的类。

我的HTML

<table class="table table-light table-bordered text-center">
    <thead class="thead-dark">
    <tr>
        <th scope="col">Ava</th>
        <th scope="col">Full name</th>
        <th scope="col">Registred</th>
    </tr>
    </thead>
    <tbody>
    {{#users}}
        <tr class="table-light" id="colorised">
            <td><img src="{{avaUrl}}" width="42" height="42"/></td>
            <td><a href="users/{{_id}}" style="margin-top: 50px;">{{username}}</a></td>
            <td>{{registeredAt}}</td>
        </tr>
    {{/users}}
    </tbody>
    {{^users}}
    </br>
    <strong style="color: orange">No results for "{{searchedUsername}}"</strong>
    </br>
    </br>
    {{/users}}
</table>

和JavaScript

<script>
      $('#colorised').attr('class','table-success');
</script>

如何更改表行的颜色?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/50189
 
1341 次点击  
文章 [ 2 ]  |  最新文章 5 年前