我使用的jQuery與localStorage的力量。JQuery - 使用.html()設置後獲取.html()
以下是我有:
<textarea name="localStorageString" id="localStorageString"></textarea>
<script>
var userJson = localStorage.getItem('userJson');
$('#localStorageString').html(userJson);
$('#localStorageString').keyup(function(){
alert($(this).html());
});
的textarea
填寫正確,問題是,當我修改它,它總是提醒相同的值(由html(userJson)
設置)。
有什麼想法?
好的。但在textarea的情況下,爲什麼不會是相同的結果? – Max13
其jQuery API。我想它爲您提供了對錶單元素及其值的統一訪問。這真的很有道理。 – erlrange