开发者

How to add contentEditabled div with prototype in IE8

开发者 https://www.devze.com 2023-01-22 19:24 出处:网络
I have the following piece of code: <form action=\"/fake\" > <div id=\"root\"> </div> </form>

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 :-(. Wh开发者_开发问答at 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.

0

精彩评论

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