开发者

how to make editable span in fire fox

开发者 https://www.devze.com 2023-01-13 05:22 出处:网络
even by setting contentEd开发者_开发知识库itable=\"true\" in span tag , in fire fox this tag is not able to edit while there is no problem in IE. what can i do?contenteditable is a new html5 attribute

even by setting contentEd开发者_开发知识库itable="true" in span tag , in fire fox this tag is not able to edit while there is no problem in IE. what can i do?


contenteditable is a new html5 attribute, Chk if your browser supports it.

<!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>

Incase you searching for a fix then,here is a plugin called contentEditable jQuery Plugin. url: http://valums.com/edit-in-place/


That's because the contentEditable is not valid HTML, even if it is recognized by IE.

contentEditable attribute is valid HTML5 attribute and Firefox handle it pretty well from what I see.


First off, and I may be mistaken here, but the correct usage from what I've seen across the web is lowercase and not camelcase.

<span contenteditable="true">EDIT THIS!</span>

Works in Firefox>MacOSX just fine, even without setting doctype.

The only explanation I can think of is that your Firefox version is outdated and you need to upgrade.


it worked but when the span tag is in li tag it wont work!!

  • EDIT THIS!

this tag never is able to be edited

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号