简体   繁体   English

如何在输入类型文本(文本字段)中创建表?

[英]How to create table inside an Input type text (text field)?

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> ? 编辑:我在想是否有办法说突出显示文本的某个部分并从那里<table><th><td>应用表格html标签? but what about the tag attributes? 但是标签属性呢?

You can't create a table inside a input . 您无法在input创建表格。

⋅ ⋅ ⋅ ⋅⋅⋅

But you can use a div with the contenteditable property to create a modifiable table: 但是您可以使用具有contenteditable属性的div创建可修改的表:

 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. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM