Return to Snippet

Revision: 35306
at November 5, 2010 07:24 by DrCord


Initial Code
var foo = document.getElementById('yourSelect');
if (foo)
{
   if (foo.selectedIndex != null)
   {
       foo.selectedIndex = 0;
   } 
}

Initial URL
www.CordSlatton.com

Initial Description
Very useful for changing the selected option in a select dropdown

Initial Title
Check if option is selected, if not select default

Initial Tags


Initial Language
JavaScript