Form関連の要素の値を初期化


// textarea, inpu[type="text"], input[type="checkbox"], input[type="radio"], optionの値を初期化
var initializeState = function() {
$(':text').each(function() {
$(this).val($(this).attr('defaultValue'));
});

$(':checkbox, :radio').each(function() {
$(this).attr('checked', $(this).attr('defaultChecked'));
});

$('option').each(function() {
$(this).attr('selected', $(this).attr('defaultSelected'));
});
};

リロードするとForm関連の要素の値が初期化されないから書いてみた。
jQueryを使用。