[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3627
  • Last Modified:

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?
0
Eddie Shipman
Asked:
Eddie Shipman
  • 5
  • 2
1 Solution
 
Gurvinder Pal SinghCommented:
did you tried this?

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

0
 
Eddie ShipmanAll-around developerAuthor Commented:
No, but I will and let you know.
0
 
Eddie ShipmanAll-around developerAuthor Commented:
It changes the val() but it does not reset the text.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Eddie ShipmanAll-around developerAuthor Commented:
You DO know that that was my question, don't you?
0
 
Eddie ShipmanAll-around developerAuthor Commented:
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.

0
 
Eddie ShipmanAll-around developerAuthor Commented:
Thanks for pointing out the obvious to me.
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now