简体   繁体   English

自动刷新div下一行

[英]Auto refresh div going next line

I have a simple code with jquery and slim framework and here it is: 我有一个简单的代码与jquery和苗条的框架,这是:

jquery: jQuery的:

var auto_refresh = setInterval(
function ()
{
$('#counter').load('/requests/autoloader').fadeIn("slow");
}, 5000);

/requests/autoloader route /requests/autoloader路线

$stat = 1;
$requests = $dbh->prepare("SELECT COUNT(*) FROM encashments WHERE status = ? ");
$requests->execute(array($stat));
$reqs = $requests->fetchColumn();
echo $reqs;

My html: 我的html:

<li role="presentation"><a href="/user/admin/encashment/requests">Encashment Requests <div id="counter" style="color:red;"></div></a></li>

Everything is working fine, but I wonder why the div moves to the next line? 一切工作正常,但我不知道为什么div移至下一行? Looks like this: 看起来像这样: 在此处输入图片说明

As you can see, the number is below the Encashment Requests link and I want it just to be beside it. 如您所见,该数字位于“ Encashment Requests链接下方,我希望它仅在旁边。 How can I do it? 我该怎么做? Thank you. 谢谢。

Try setting #counter css property display to inline-block 尝试将#counter css属性display设置为inline-block

 #counter { display:inline-block; } 
 <li role="presentation"><a href="/user/admin/encashment/requests">Encashment Requests <div id="counter" style="color:red;">3</div></a></li> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM