Form tag won't enclose elements inside a table

前端 未结 3 891
被撕碎了的回忆
被撕碎了的回忆 2021-01-04 10:27

I\'ve run into a curious problem; I\'ve got a form inside a , however the form refuses to wrap any tags inside it. I\'ve made a quick JSFiddle here to

相关标签:
3条回答
  • 2021-01-04 10:51

    The <form> tag can only be placed inside a <td> element or outside the <table> in this case.

    If I were you, I'd just put the <form> around the whole table since you said there won't be any other forms within it.

    Or, you could replace the <table> completely with <div>s instead that use display: table; or display: table-cell;.

    0 讨论(0)
  • 2021-01-04 11:02

    you can only put a form inside a td basically, so you could put those 2 rows inside a new table that you create inside a td
    like ...

    <table><tr><td><form><table><tr>...</tr><tr>...</tr></table></form></td></tr><tr>...</tr><tr>...</tr></table>
    
    0 讨论(0)
  • 2021-01-04 11:11

    You cannot interrupt the <table> structure with any tags besides <thead>, <tfoot>, <tbody>, <tr>, <th>, or <td>. You form tags need to be encapsulated between two <td> or your entire <table> needs to be placed within the <form> tag.

    <table>
        <tr>
            <td>
                <form>
                ...form data...
                </form>
            </td>
        </tr>
    </table>
    

    ..or..

    <form>
        <table>
        ...
        </table>
    </form>
    
    0 讨论(0)
提交回复
热议问题