我如何使用uniqueId()jQuery UI [英] How do I use uniqueId() jquery ui
本文介绍了我如何使用uniqueId()jQuery UI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
jquery ui似乎已加载,因为当我运行时
It seems jquery ui is loaded because when i run
$(function(){
// did the UI load?
console.log($.ui.version);
});
JS控制台返回1.10.3
the JS console returns 1.10.3
我正在使用宝石 https://github.com/joliss/jquery-ui-rails (最新) 和 https://github.com/rails/jquery-rails 版本2.1.4
I am using the gem https://github.com/joliss/jquery-ui-rails (most recent) and https://github.com/rails/jquery-rails version 2.1.4
我正在尝试为每个YouTube嵌入的iframe生成唯一的ID
I am trying to generate unique IDs for each youtube embed's iframe
$(".youtube_embed iframe").each.uniqueId();
我做对了吗? 我在JS控制台中收到此错误:
am i doing it right? I get this error in the JS console:
Uncaught TypeError: Object function ( callback, args ) {
return jQuery.each( this, callback, args );
} has no method 'uniqueId' 1:938
(anonymous function)
推荐答案
您应该迭代每个匹配的元素并为每个元素分配唯一的ID.
You should iterate each matching element and assign each element an unique id.
$(".youtube_embed iframe").each(function() {
$(this).uniqueId();
});
这篇关于我如何使用uniqueId()jQuery UI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文