我正在开发一个文本编辑器。当用户双击特定的
<div>
时,将设置contentEditable
属性为true
并显示一些编辑器工具。然后,用户可以选择单击“保存”或“取消”。如果他选择取消,则希望还原此中的先前数据。所以,我在第一次双击时复制了数据(
temp['htmlTxt']
),然后:$('#esc').click(function() {
var confEsc = confirm('---\n\nSouhaitez-vous quitter sans enregistrer vos modifications ?\n\n---');
if(confEsc) {
//Do you know why that works :
var id = document.getElementById(temp['myId']);
id.innerHTML = temp['htmlTxt'];
//and why that doesn't work ?
$('#'+temp['myId']).html(temp['htmlTxt'])
}
});
我不明白为什么使用经典的JavaScript可以正常工作,而使用jQuery却不能...
temp['htmlTxt']
等于什么? - qwertymk