单击按钮时如何显示与DIV ID相关的消息

时间:2018-07-05 08:53:54

标签: jquery

点击按钮,我正在尝试显示

的消息

我尝试过

<input type="button" id="mybtn" class="btn" value="Show Message"  />

<table class="zui-table">
    <thead>
        <tr>
            <th>Name</th>
            <th>Position</th>
            <th>Height</th>
            <th>Born</th>
            <th>Salary</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>DeMarcus Cousins</td>
            <td>C</td>
            <td>6'11"</td>
            <td>08-13-1990</td>
            <td>$4,917,000</td>
        </tr>

    </tbody>

    <tfoot id="footerid">
                <tr>
                    <td colspan="6"><p class="alert alert-warning text-center">My Custom Message</p></td>
                </tr>
            </tfoot>

</table>



$(document).on("click","#mybtn",function() {

 $('#footerid p').delay(5000).fadeOut(400); 

});

这是我的小提琴

https://jsfiddle.net/o2gxgz9r/54488/

1 个答案:

答案 0 :(得分:1)

您应该尝试这样

$('#footerid p').hide()
$(document).on("click","#mybtn",function() {

 $('#footerid p').show();   

});

您更新的JSFIDDLE