Created
August 2, 2011 12:28
-
-
Save henningjensen/1120088 to your computer and use it in GitHub Desktop.
jquerymobile - reset form issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>reset form problem</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link rel="stylesheet" media="all" href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css" /> | |
<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script> | |
<script src="http://code.jquery.com/mobile/latest/jquery.mobile.min.js"></script> | |
</head> | |
<body> | |
<div data-role="page" id="page-start"> | |
<div data-role="header"> | |
<h1>header</h1> | |
</div> | |
<div data-role="content"> | |
<form> | |
<label for="name">Name:</label><input type="text" name="name" /> | |
<select name="country[]" multiple="multiple" data-native-menu="false"> | |
<option value="">Select country</option> | |
<option value="no">Norway</option> | |
<option value="se">Sweden</option> | |
<option value="dk">Denmark</option> | |
</select> | |
<input type="submit" value="Submit" /> | |
<input type="reset" value="Reset" id="btn-reset" /> | |
</form> | |
<script> | |
$('#btn-reset').live('vclick', function() { | |
console.log("reset button clicked"); | |
$('select option[value=""]').attr('selected', 'selected'); | |
$('select').selectmenu(); | |
$('select').selectmenu('refresh'); | |
}); | |
</script> | |
</div> | |
<div data-role="footer"> | |
<h1>footer</h1> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment