I'm just starting my initial journey into jquery, and I basically need
the jquery syntax equivalent of this:

document.formName.selectName.selectedIndex = 0;
document.formName.selectName.options[0].selected = true;


Here is the relevant code (this is supposed to happen once an id'ed
element is clicked):

jquery:
$("#showall").click(function(){
                document.example.state.selectedIndex = 0;
                document.example.state.options[0].selected = true;
        });

html:
<form name="example" action="#">
  <select name="state" id="state" class="selector">
      <option value="selectone" selected="selected">Select One</
option>
      <option value="all-50-states">States 1-50</option>
  </selected>

Reply via email to