Safari <select> onchange form submit broken in 1.2
In my form I have a <select> box and I want the form to automatically submit when the user selects an option.
The following code works fine in IE/FF/Safari (desktop version)
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
- <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
- <script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
- </head>
- <body>
- <div data-role="page" id="page1">
- <div data-role="content">
- <form id="animalform" action="notexist.html" data-ajax="false" method="POST">
- <select name='animal' id='animal' onchange='doChange()'
- data-inline='true' data-native-menu='false'>
- <option>What do you prefer?</option>
- <option value='3' >Cat</option>
- <option value='4' >Dog</option>
- <option value='5' >Pony</option>
- </select>
- </form>
- </div>
- </div>
- <script type='text/javascript'>
- function doChange()
- {
- $('#animalform').submit();
- }
- </script>
- </body>
- </html>
It submits to notexist.html, when you see the error you know it submitted.
When I replace the head with
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0-alpha.1/jquery.mobile-1.2.0-alpha.1.min.css" />
- <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
- <script src="http://code.jquery.com/mobile/1.2.0-alpha.1/jquery.mobile-1.2.0-alpha.1.min.js"></script>
the form is not submitted with Safari anymore. No error or anything.