how to iterate through multiple select options with jquery

Posted by amir on Stack Overflow See other posts from Stack Overflow or by amir
Published on 2009-08-04T13:56:26Z Indexed on 2010/03/24 19:13 UTC
Read the original article Hit count: 544

Filed under:

I was just wondering if it's possible to go through multiple select options and get their values and text(if one is selected get the value and text, if 2 is selected get both of their values and text and so on)

I have 15 select boxes in one page?

any help would be appreciated.

 <form>
        <select class="select" name="select3" id="select3">
          <option value="0">0</option>
          <option value="1.99">1</option>
          <option value="1.99">2</option>
          <option value="1.99">3</option>
          <option value="1.99">4</option>
          <option value="1.99">5</option>
          <option value="1.99">6</option>
          <option value="1.99">7</option>
          <option value="1.99">8</option>
        </select>
        </form>

  <form> 
      <select  class="select" name="select" id="select">
            <option value="0">0</option>
            <option value="1.99">1</option>
            <option value="1.99">2</option>
            <option value="1.99">3</option>
            <option value="1.99">4</option>
            <option value="1.99">5</option>
            <option value="1.99">6</option>
            <option value="1.99">7</option>
            <option value="1.99">8</option>
          </select>
   </form>

all the select options have the same class.

thanks

© Stack Overflow or respective owner

Related posts about jQuery