This might be kind of a weird question, but is it possible to build table cells that are partially editable, but also partially un-editable? By this I mean, I want to use JavaScript to make a majority of the cell editable by setting .contentEditable = true
in JavaScript (already done). However, I also want a portion (preferably on the right side) to be text that cannot be written over or edited.
What I'm trying to do here is make most of the table cell editable to put in raw data, i.e. numbers. But to leave an stagnate section with a unit, so that the unit doesn't actually get taken as input (it's more just like decoration).
I've drawn a mock-up of what I'm imagining, if this helps:
So far, I've tried adding a <input>
element after the initial input following <td>
, then style the input to set point-events: none
. But this does not look good and ends up creating an input form inside of a content editable cell, which isn't really what I want, and ends up looking like this:
I think it would have to use some CSS overlay and not actually be apart of the table HTML. Either way, how would I go about this?