我有一些选择。
I also have a function that when the option changes it saves it to local storage
input1save = $('#answer1 option:selected').val
localStorage['ScienceSkills-QuestionsTest-1-1421-6845-5309-4850-5124'] = input1save
当页面重新加载时,我有一个功能,其中显示带有选项值的警报(使用本地存储)
input1save = localStorage['ScienceSkills-QuestionsTest-1-1421-6845-5309-4850-5124']
alert(input1save);
但是它会用大量随机代码而不是值发出警报
我知道保存功能有效,因为如果我使用
input1save = "foo"
它提醒“foo”
因此问题来自
$('#answer1 option:selected').val