gpt4 book ai didi

html - 如何在 Firefox 中创建可编辑范围

转载 作者:搜寻专家 更新时间:2023-10-31 08:22:06 24 4
gpt4 key购买 nike

即使在 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com