contenteditable=false inside contenteditable=true block is still editable in IE8

后端 未结 3 763
南笙
南笙 2020-11-28 12:10

I have the following HTML intending to make sure that the inner span isn\'t editable. This works in other browsers but not IE8.

3条回答
  •  悲&欢浪女
    2020-11-28 12:32

    Okay, I already have discovered the answer much like how Penicillin was discovered.

    You see, playing around with this code, I mistakenly set contenteditable to true for the span and voila! It worked!

    So, to make a span NON-contenteditable inside a contenteditable div, you just set its contenteditable attribute to true!

    Luke, I am your father. I'm your son?! Ewww! Don't speak back to me!

    Here's the file to demonstrate (use IE8 to open it): https://codepen.io/hgezim/pen/qMppLg .

    Lastly, I didn't post the question to get votes (although, they wouldn't hurt!), but since the solution was so ridiculous and I didn't find it here, I thought someone may find this tip time saving.

提交回复
热议问题