Trouble with "class"

Forgive my noobness, but my attempts to use "class" instead of "id" on links for modals isn't working.

When I use id="modalroom", this code works fine:


<script type="text/javascript">
Event.observe(window,'load',function(){
new Control.Modal($('modalroom'),{
opacity: 0.8,
width: 600
});
});
</script>

but when I want to use class instead, I get nothing. The control.modal home page says you can use class="modal" on links and this javascript:

    $$('a.modal').each(function(link){
        new Control.Modal(link);
    });

so I try this and get no modal:

<script type="text/javascript">
    $$('a.modal').each(function(link){
        new Control.Modal(link,{
            opacity: 0.8,
            width:600
        });
    });
</script>

What modifications do I need to make to that last bit of code to help me use class for modal links instead of id?

Posted June 8th, 2007 at 1:57pm by tonywhite

The "modal" class was an example, you'll have to actually put the class "modal" on your links.

Posted June 8th, 2007 at 4:02pm by ryan

Login or Register to Post