Your welcome, though I noticed something wrong...this should be a bit better

$("select").children("option").each(function() {
        if ( $(this).html() == varDay ) {
                $(this).attr("selected","selected");
        }
});



Nic Hubbard wrote:
Perfect!  Thank you!


On Feb 22, 1:34 pm, Liam Potter <[email protected]> wrote:
oh ok, same idea then I assume the days are displayed as numbers

$("select").children("option").each(function() {
        if ( $("select").children("option").html() == varDay ) {
                $(this).attr("selected","selected");
        }

});
Nic Hubbard wrote:
I am not needing a class.  This is a select input menu, that has
options for 1-31.  I need to have the correct option set as the
selection option, based on what day it currently is.
On Feb 22, 1:12 pm, Liam Potter <[email protected]> wrote:
put id's on the days of the month eg id="day1"
then you could do $("day"+dayVar"").addClass("activeclass"); Nic Hubbard wrote:
I have a var that gets set with the current day, so, today would be
22.  Then, I have  a select menu with all the days of the month.  How
could I set the selected item in the select menu to the current day
that is in my var?

Reply via email to