I am looking to create a table cell that is editable like in Excel. When clicking on the cell, I want a highlighted box to appear for editing and if the entered text exceeds the cell width, it should grow accordingly. Once editing is completed, the cell should display as normal with any excess text being truncated. Essentially, I want the functionality of an Excel sheet cell.
So far, I have tried the following:
<td contenteditable="true" class="content" style="overflow:hidden"></td>
I also attempted to set the z-index to 15 on focus event and remove it on blur event. However, the text entered is not getting trimmed and the cell width updates based on the text length.
Another approach I tried was:
<td><div contenteditable="true" style="width:100%; height:100% overflow:hidden"></div>
</td>
But unfortunately, the overflow property does not seem to be working as intended.
If anyone has a solution or suggestion, I would greatly appreciate the help. Thank you in advance.