Solved

jQuery MSDropDown-> Resetting to first option

Posted on 2011-09-08
7
3,458 Views
Last Modified: 2012-05-12
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
Comment
Question by:EddieShipman
  • 5
  • 2
7 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36505875
did you tried this?

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

0
 
LVL 26

Author Comment

by:EddieShipman
ID: 36506125
No, but I will and let you know.
0
 
LVL 26

Author Comment

by:EddieShipman
ID: 36506179
It changes the val() but it does not reset the text.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 36506213
0
 
LVL 26

Author Comment

by:EddieShipman
ID: 36506626
You DO know that that was my question, don't you?
0
 
LVL 26

Author Comment

by:EddieShipman
ID: 36506666
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
 
LVL 26

Author Closing Comment

by:EddieShipman
ID: 36506667
Thanks for pointing out the obvious to me.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Hi all! Recently there was EE question and the person wanted to have a multi-column textbox <div> selection, so as a first step to answer I provided a link but that was not complete with JavaScript selection, but had a good style sheet. So as a ques…
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now