我正在尝试检查所选元素是否为视频。
我的 html
<div class='component'>
<video><source.../></video>
</div>
我的 js
$('.component').on('click', function(){
var newElement = $(this).children().first(); //I need to keep the children().first() for
other purpose
if(newElement.find('video').length){ //this will never be true..
alert('is video')
}
})
如何检测 newElement
是否为 video
标签?非常感谢!
最佳答案
if (newElement.is('video')) {
关于jquery - 如何检查变量是否是视频标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21590525/