0
我在我的信息信息页上有一个div,但我希望它不可见,如果它是空的。 我在我的布局文件中使用了下面的jQuery脚本,但它似乎没有工作。我得到一个空的蓝色框,但我希望它被隐藏,除非它里面有内容。jQuery:空不工作在翡翠
script(type='text/javascript')
$('#info:empty').hide();
实际翡翠文件只是有:
extends layout
block head
title Test page
block content
if (message)
#info= message
我有另一个工作jQuery脚本变淡全格了,所以我不认为它与布局文件有问题,但在这里它无论如何:
head
link(href='http://fonts.googleapis.com/css?family=Open+Sans', rel='stylesheet', type='text/css')
link(href="/stylesheets/style.css", type="text/css", rel="stylesheet")
script(type='text/javascript', src="http://code.jquery.com/jquery-1.9.1.min.js");
script(type='text/javascript')
$(document).ready(function(){
setTimeout(function(){
$("#info").fadeOut("slow", function() {
$("#info").remove();
});
}, 2000);
});
script(type='text/javascript')
$('#info:empty').hide();
meta(http-equiv='Content-Type', content='text/html; charset=utf-8')
block head
body
block content
完美。谢谢! – karoma 2013-03-10 18:05:25