Link to home
Start Free TrialLog in
Avatar of Eddie Shipman
Eddie ShipmanFlag for United States of America

asked on

jQuery MSDropDown-> Resetting to first option

I've found numerous references to setting the first option in the msdropdown using this code:
    var oHandler = $('#input_zip').msDropDown().data("dd");
    if(oHandler) {
      oHandler.set("selectedIndex", 0);
    }

Open in new window


Now, in IE8, I'm seeing a problem with this as I get the "A script on this page is causing Internet Explorer to run slowly..." error dialog when executing the first line.

I know it's the code above causing it because I've added breakpoints to see. If I use this code:
  $('#input_zip').msDropDown().setValueByIndex ("selectedIndex", 0);

Open in new window

It does essentially the same thing and I still get the error.

Any ideas?
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

did you tried this?

$("#input_zip").val($("#input_zip option:first").val());

Avatar of Eddie Shipman

ASKER

No, but I will and let you know.
It changes the val() but it does not reset the text.
ASKER CERTIFIED SOLUTION
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You DO know that that was my question, don't you?
While I accepted that post as the answer in the other question, I did not try the code. I used the code in the last post.
If I'd used the code in the accepted solution, my troubles would have been over.

Thanks for pointing out the obvious to me.