Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a non content editable div inside a content editable iframe?

Tags:

javascript

I need to make a some parts inside an contenteditable iframe as non-editable. How do I do that? The below code works in chrome but not in firefox. Everything is editable in firefox. Ineed the checkbox to be noneditable

<iframe contentEditable="true" >
    Editable text<div contentEditable="false"><input type="checkbox" /></div>
</iframe>
like image 809
Gautham Renganathan Avatar asked Nov 01 '25 11:11

Gautham Renganathan


1 Answers

Use this:

Editable text<div contentEditable="false" readonly>Non content editable text</div>

If you want to use JQuery:

$('#divId').attr('readonly', 'true');
like image 67
Sankalp Mishra Avatar answered Nov 03 '25 03:11

Sankalp Mishra