Ok, figured it out, just in case someone else needs it (there is
probably a better way yet...

        //check to make sure the slot is not already full
        var selectedValue;
        var revert = false;
        $('.ddl_slots').change(function() {
                selectedValue = $(this).val();
                $('.ddl_slots').each(function() {
                        if ($(this).val() == selectedValue)
                        {
                                revert = true;
                        }
                });
                if (revert)
                {
                        $(this).val("");
                        alert("This slot is already selected for another 
player");
                }
        });

On Jun 9, 11:51 am, pixelwiz <pixel...@gmail.com> wrote:
> But how do I add in the fact that I need to check that the currently
> selected value is not already selected in one of the other 50 drop-
> down lists on the page?  Somehow I need to check if $(this).val() ==
> compare to each selected value in every select on the page.
>
> Thanks
>
> On Jun 9, 11:45 am, waseem sabjee <waseemsab...@gmail.com> wrote:
>
> > $("select").change(function() {
>
> > var sval = $(this).va();
> > if(sal == 5) {
>
> > } else {
> >  // do something
> > }
> > });
> > On Tue, Jun 9, 2009 at 5:35 PM, pixelwiz <pixel...@gmail.com> wrote:
>
> > > Hi, I have a little problem.
>
> > > I have a page that displays a list of people playing in a
> > > tournament.
>
> > > I need to be able to generate a Leaderboard based on which players are
> > > manually selected by the admin.
>
> > > Next to each person there is a drop-down list. An admin can go in and
> > > select a "slot" that a player should be in on the leader board from 1
> > > to 8, or leave it blank if none.
>
> > > What I need to figure out how to do is the following, when a change
> > > event happens on a drop-down list, and say the value 5 is selected, I
> > > need to check to make sure that 5 is not already selected in one of
> > > the other players drop-down lists, in other words, that the 5th
> > > leaderboard slot is not already full.  if it is, display an error
> > > message and make them change that one first.
>
> > > Any idea how to do that with jQuery?  I'm thinking it will have
> > > something to do with the each() function, but not sure exactly how the
> > > logic should work.

Reply via email to