点击Dissapear html div

时间:2014-02-04 22:01:51

标签: javascript jquery html css

为什么当我点击按钮时状态刷新,但按钮消失了?

IS

$( ".refreshstatus" ).click(function(){
    $( ".navplayers" ).load('stats.php');
});

CSS

.refreshstatus{
    font-family:'Noto Sans';
    font-weight: 900;
    text-align:center;
    background-color:tomato;
}

HTML

<div class="refreshstatus">Refresh</div>

stats.php

    <?php include ("statsfunction.php"); ?><?php if( ( $Players = $Query->GetPlayers( ) ) !== false ): foreach( $Players as $Player ): ?>                                           
        <img src="https://minotar.net/avatar/<?php echo htmlspecialchars( $Player ); ?>/32"><div class="playerinfo" id="<?php echo htmlspecialchars( $Player ); ?>"><?php echo htmlspecialchars( $Player ); ?></div></img>                                                                  
    <?php endforeach; else: ?>
    No players
    <?php endif; ?>
    <p><b>Players <?php echo "<font color='green' ><?php $players_online ?></font>"  ?> online</b></p>
<div class="col-sm-3 navplayers">
<?php include ("stats.php"); ?>
<div class="refreshstatus">Refresh</div>
</div>  

1 个答案:

答案 0 :(得分:0)

好的,您的div.refreshstatus与您加载的内容重叠。制作一个合适的按钮或使用<a>链接。

像...一样的东西。

<div class="col-sm-3 navplayers">
<?php include ("stats.php"); ?>
    <a href="#" class="refreshstatus">Refresh</a>
</div> 

或按钮......

<div class="col-sm-3 navplayers">
<?php include ("stats.php"); ?>
    <button type="button" class="refreshstatus">Refresh</button>
</div>