Rawan Mansour
Rawan Mansour

Reputation: 111

Prevent some content from being edited in contenteditable td

I have a td in a table with contenteditable="true". Inside the td I have a span with some contents. I want to make the td editable except this span. How can I do that?

<td colspan="4" contenteditable="true">
  <span class='notForEdit'><i class="fa fa-cog"></i><span>
</td>

Upvotes: 0

Views: 481

Answers (2)

Sparky
Sparky

Reputation: 297

You could try to do things like this.

td{
margin:0;
padding:0;
}
p{
float:left;
padding:0.1em;
}
<td>
<p contenteditable="true">
This is a paragraph annd is editable. 
</p>
<p>A solid text.</p>
<p contenteditable="true">
next stuff. 
</p>
</td>

Upvotes: 1

CrazyProg
CrazyProg

Reputation: 71

Why not do this like that :

<td colspan="4">
  <span contenteditable="true">
    editable test
  </span >
  <span contenteditable="false"><i class="fa fa-cog"></i><span>
  <span contenteditable="true">
    more editable test
  </span >
</td>

Upvotes: 1

Related Questions