即使在 span 标签中设置 contentEditable="true",在 fire fox 中这个标签也无法编辑,而在 IE 中没有问题。我能做什么?
最佳答案
contenteditable 是一个新的 html5 属性,如果您的浏览器支持它,请检查它。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>test</title>
<script>
if('contentEditable' in document.createElement('span')){
alert('ContentEditable is supported by your browser');
}else{
alert('ContentEditable is not supported by your browser');
}
</script>
</head>
<body>
<h2> To-Do List </h2>
<ul contenteditable="true">
<li> <span>Break mechanical cab driver. </span></li>
<li> <span>Drive to abandoned factory</span></li>
<li><span> Visit Dentist</span> </li>
</ul>
</body>
</html>
如果您正在寻找修复程序,这里有一个名为 contentEditable jQuery 插件的插件。 网址:http://valums.com/edit-in-place/
关于html - 如何在 Firefox 中创建可编辑范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3589483/