Created
August 25, 2015 15:36
-
-
Save shiranuik/f9e20b5ec176aa6a8894 to your computer and use it in GitHub Desktop.
jQueryでブラウザ戻るボタンによるフォームずれ対応
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
// option[selected]によって「ソース上の」選択状態を取得。 | |
var tmpSelect = $('select[name="selectName"] option[selected]').val(); | |
// option:selected (見かけ上の選択状態)を削除。 | |
$('select[name="selectName"] option:selected').removeAttr('selected'); | |
// 改めて選択を設定しなおす。 | |
$('select[name="selectName"]').val(tmpSelect); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment