Bug in .val() on select with jQuery Mobile?

Bug in .val() on select with jQuery Mobile?

Hi all

I'm having a problem with `.val()` and jQuery Mobile.

This is my code in total. The attempt to set the value of the select as Quietest is not working: it selects Balanced.

  1. <!DOCTYPE html> 
  2. <html> 
  3. <head> 
  4. <title>Page Title</title> 
  5. <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
  6. <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
  7. <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
  8. <script type="text/javascript">
  9. $(document).ready(function() {
  10.        $("#routetype").val('quietest');
  11.      });
  12. </script>
  13. </head> 
  14. <body> 
  15.     <!-- Start of first page -->
  16.     <div data-role="page" id="foo">
  17.      <div data-role="header">
  18.      <h1>Foo</h1>
  19.      </div><!-- /header -->
  20.      <div data-role="content">
  21.      <select id="routetype" name="routetype">
  22.             <option value="fastest">Fastest</option>
  23.             <option value="balanced">Balanced</option>
  24.             <option value="quietest">Quietest</option>
  25.             </select>
  26.         </div><!-- /content -->
  27.     <div data-role="footer">
  28.      <h4>Page Footer</h4>
  29.      </div><!-- /header -->
  30.     </div><!-- /page -->
  31. </body>
  32. </html>

However, if I remove the jQuery mobile script, it works perfectly.

Any thoughts?