Oh yes, sorry I forgot the ); after the function passed to $.each().
Corrected (and tested!) version is below:

function test()
{
   $("#smsUserPrice option").each(function()
   {
      // $(this) is the current <option> element
      var value = $(this).val();

      if (value == "z")
         $(this).attr("selected", true);
   });
}


--rob

On 5/24/07, Karl Swedberg <[EMAIL PROTECTED]> wrote:

Hi Jakob,
Instead of:

 $(curSmsOption).attr("selected", "true");

try:

 $(curSmsOption).attr("selected", "selected");


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On May 24, 2007, at 8:00 AM, [EMAIL PROTECTED] wrote:

for(var i=0; i<$("#smsUserPrice").children().size(); i++){

   curSmsOption = $("#smsUserPrice").find("option:eq("+i+")");


    if($(curSmsOption).attr("value") ==

eventObjects[clickedObject.attr('id')].find('Price').text()){

    $(curSmsOption).attr("selected", "true");

   }

   }






--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
"There's a whale there's a whale there's a whale fish" he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.

Reply via email to