views:

52

answers:

4

even by setting contentEditable="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?

A: 

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.

Crozin
A: 

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.

Moses
A: 

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

  • EDIT THIS!

this tag never is able to be edited

adrakadabra
Well it won't work on StackOverflow, because of the way the system strips out all attributes for security reasons. Otherwise, it works fine...
Yi Jiang
+1  A: 

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/

Meryl