0

I want to create a dynamic size table inside a text field(input type="text") It is to be created by the click of a button, the table will be filled from within that text-box before the whole post being submitted.

So its a text box for blog posting, so that the table will be posted along with the text.

how to do that? (in the simplest way please).

Edit: i was thinking is there a way to say highlight a certain part of the text and apply table html tags from there <table><th><td>? but what about the tag attributes?

3
  • Provide code you tried Commented May 21, 2018 at 18:10
  • You should show us an example of the inputs/outputs you want. I don't understand all your needs. Commented May 21, 2018 at 18:16
  • @TakitIsy the input is an input-button to create a table where the cursor is, inside the input-text box. i don't have an example, i am at the start of my project, it is just some basic html tags. Commented May 21, 2018 at 18:28

1 Answer 1

1

You can't create a table inside a input.

⋅ ⋅ ⋅

But you can use a div with the contenteditable property to create a modifiable table:

table td{
  border: 1px solid black;
  padding: 4px 12px;
}
<div contenteditable=true>
  <table>
    <tr>
      <td>1</td>
      <td>2</td>
      <td>3</td>
    </tr>
    <tr>
      <td>4</td>
      <td>5</td>
      <td>6</td>
    </tr>
    <tr>
      <td>7</td>
      <td>8</td>
      <td>9</td>
    </tr>
  </table>
</div>

Hope it helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.