On Jun 2, 1:08 pm, Ricardo <ricardob...@gmail.com> wrote:
> Or add another class name:
>
> <select class="myselects">
>    <opt.../>
> </select>
>
> <select class="myselects">
>    <opt.../>
> </select>
>
> $('.myselects:not(.clicked)').live('click', function(){
>      $(this).addClass('clicked');
>
> });
>
> On Jun 2, 1:00 pm, Isaac Gonzalez <ier...@gmail.com> wrote:
>
> > I'm not sure if this is the best solution but you can always change  
> > the class name of the li after it's been click. Then add a conditional  
> > statement in your anonymous function filter list with the revised  
> > class name.
>
> > On Jun 2, 2009, at 8:55 AM, Laker Netman wrote:
>
> > > I am using .live() in jQuery 1.3.2 to assign a dynamic click event to
> > > multiple Select lists. When one of the lists is clicked on I would
> > > like to have that particular list to no longer be "clickable".
>
> > > Here's the issue. I currently assign the click function in .live()
> > > with an anonymous function, so the only thing I have been able to do
> > > so far is $(this).die('click') when a Select is clicked on. This, of
> > > course, kills the event for ALL my Selects.
>
> > > Does anyone know of a way to do this without creating a separate,
> > > named function for the die() function to use later?
>
> > > Thanks,
> > > Laker

Thanks for the suggestions Isaac.

Your second post got me thinking. Here's what I came up with for the
final solution:
        $(".selectList:not(.clicked)").live("mousedown",function(){
                $(this).addClass('clicked');
... additional processing occurs here ....
        });

This is executed within $document.ready()
All of the Selects have the class "selectList" from the start and,
based on your suggestion, the "clicked" class is added when a
particular list is clicked on. The initial selector does the rest,
eliminating already clicked selects from future consideration. Very
nice!

Laker

Reply via email to