Javascript 使用jquery展开视频标记
我有这个:Javascript 使用jquery展开视频标记,javascript,jquery,video,tags,forced-unwrapping,Javascript,Jquery,Video,Tags,Forced Unwrapping,我有这个: <div class="vid"> <video> bla bla bla </video> </div> 控制台窗口中的结果是: TypeError: undefined is not a function message: "undefined is not a function" stack: (...) get stack: function () { [native code] } set stack: function
<div class="vid">
<video> bla bla bla </video>
</div>
控制台窗口中的结果是:
TypeError: undefined is not a function
message: "undefined is not a function"
stack: (...)
get stack: function () { [native code] }
set stack: function () { [native code] }
__proto__: Error
有线索吗
太多了 似乎未定义
$
。您确定jQuery已加载吗
您可以尝试console.log
ing这些:
console.log(window.jQuery); // What's the output of this?
console.log($); // What's the output of this?
console.log(jQuery('video')); // What's the output of this?
这是调试问题的好方法。页面上是否加载了jQuery?该错误是调用
$(…)
或.unwrap()
的结果吗?尝试执行var$vid=$('video')$参阅展开()代码>并查看错误发生在哪一行。您是否在DOM就绪后执行它(例如,在$(文档)内部)。就绪(函数(){…})
?ajp15243,答案是:D.fn.D.init{0:video,length:1,prevObject:D.fn.D.init,init:function,jquery:“1.2.6”,size:function…}0:video length:1 prevObject:D.fn.D.init proto:Objectand$vid.unwrap();TypeError:undefined不是一个函数应该注意的是,如果页面上没有加载jQuery,最后一个将失败TypeError:undefined不是一个函数{return new D.fn.init(a,b)}未定义(2)函数(a,b){return new D.fn.init(a,b)}未定义(3)D.fn.D.init{0:video,length:1,prevObject:D.fn.D.init,init:function,jquery:“1.2.6”,size:function…}0:video length:1 prevObject:D.fn.D.init proto:Object undefined这里有更多jquery正在运行,是的,jquery的序列有问题。现在我把not功能块放在第一位。
console.log(window.jQuery); // What's the output of this?
console.log($); // What's the output of this?
console.log(jQuery('video')); // What's the output of this?