faster use of jquery-ui via class iteration

faster use of jquery-ui via class iteration

I found it a bit of a hassle to "register" every div that I want to use with a jquery-ui widget. So I wrote a little bit of code. Basically, every widget type gets a class name. 

For example: if you have multiple buttons you dont have to write " $('#id1".button(); $('#id2".button(); $('#id3".button(); etc anymore. You just add the class "btn" to any div in your html code and my code does the rest. 

<div class="btn"> <button onlick="">Button</button>
 <button onlick="">Button</button></div>


Widgets and their class names: button -> btn, selectmenu -> dropdn, draggable -> drag, accordion -> accord, slider -> slider, tabs -> tabs. Using any of the class names in html will activate the appropiate widget. Please let me know what you think about my idea and any suggestions you might have.

Just copy this code into your $(document).ready( function() {' part:

                                                                $('.btn').each(function() {
   
    $('#' + this.id).button();
   
    });
   
   
    $('.dropdn').each(function() {
   
    $( '#' + this.id ).selectmenu();
   
    });
   
   
    $('.drag').each(function() {
   
    $( '#' + this.id ).draggable();
   
    });
   
   
   
    $('.accord').each(function() {
   
    $( '#' + this.id ).accordion();
   
    });
   
   
    $('.slider').each(function() {
   
    $( '#' + this.id ).slider();
   
   
    });
   
    $('.tabs').each(function() {
   
    $( '#' + this.id ).tabs();
   
   
    });