Javascript 如何检查jQuery load()是否为空?
有人知道如何检查这个jQueryJavascript 如何检查jQuery load()是否为空?,javascript,jquery,load,Javascript,Jquery,Load,有人知道如何检查这个jQueryload()函数是否为空: jQuery(this).children('.content-from-far-away').load(URLvar +' .content-item:first-child'); 谢谢。希望对您有用 var element = jQuery(this) if (element) { //you can use the load function here without undefined
load()
函数是否为空:
jQuery(this).children('.content-from-far-away').load(URLvar +' .content-item:first-child');
谢谢。希望对您有用
var element = jQuery(this)
if (element)
{
//you can use the load function here without undefined or something like that
element = elment.children('.content-from-far-away')
.load(URLvar +' .content-item:first-child');
}
你说空是什么意思?我的意思是如果没有.content项:第一个子项(如果页面没有.content项元素)如果
jQuery(selector)
调用找不到任何内容,它的length
属性将是0
我最后使用了这个:jQuery(this).children('.content taged').load(href+'.content-item:first-child',函数(数据){if(jQuery(this).is(“:empty”){jQuery(this).html(“没有带有请求标记的帖子”);});