简体   繁体   中英

How to add contentEditabled div with prototype in IE8

I have the following piece of code:

<form action="/fake" >
    <div id="root">
    </div>
</form>

<script type="text/javascript">
    var root = Element.extend($("root"));

    function addTextControl()
    {
      var textCtl = new Element('div', { 'contenteditable': 'true'}).update("Next page");
      root.appendChild(textCtl);
    };

    addTextControl();
</script>

It works perfectly in FF and Chrome, but not in IE8 :-(. What is the problem with it?

Thank you in advance

Would you believe it's a casing issue?

Try this instead:

new Element('div', { 'contentEditable': 'true'})...

Note the capital E in contentEditable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM