Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use uniqueId() jquery ui

It seems jquery ui is loaded because when i run

    $(function(){
      // did the UI load?
      console.log($.ui.version);
    });

the JS console returns 1.10.3

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

I am trying to generate unique IDs for each youtube embed's iframe

$(".youtube_embed iframe").each.uniqueId();

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)
like image 466
APJ Avatar asked Mar 17 '26 03:03

APJ


1 Answers

You should iterate each matching element and assign each element an unique id.

$(".youtube_embed iframe").each(function() {
    $(this).uniqueId();
});
like image 170
Deepak Ingole Avatar answered Mar 18 '26 18:03

Deepak Ingole



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!