【问题标题】:Why doesn't table resize work here? jsfiddle url inserted为什么表格调整大小在这里不起作用?插入的jsfiddle url
【发布时间】:2015-06-21 10:23:36
【问题描述】:

如何让我的table 像 textarea 元素一样调整大小,并且 不是单独的行/列?我似乎从根本上错过了一些简单的东西。

https://jsfiddle.net/o0Ldf0us/

<table id="example">
<thead>
    <tr>
        <th>Heading1</th>
        <th>Heading2</th>
        <th>Heading3</th>
    </tr>
</thead>
<tbody>
    <tr>
        <td>Data1.1</td>
        <td>Data1.2</td>
        <td>Data1.3</td>
    </tr>
     <tr>
        <td>Data2.1</td>
        <td>Data2.2</td>
        <td>Data2.3</td>
    </tr>
     <tr>
        <td>Data3.1</td>
        <td>Data3.2</td>
        <td>Data3.3</td>
    </tr>
</tbody>

#example, th, td {
    border: 1px solid black;
    border-collapse: collapse;
}
$("#example").resizable();

【问题讨论】:

标签: jquery html html-table jquery-ui-resizable


【解决方案1】:

resizable 方法不是标准 jQuery 库的一部分 - 它是 jQueryUI 的一部分,因此您也需要包含它。完成后,您的代码将起作用:

Example fiddle

【讨论】:

  • 谢谢!所以我加入了
  • 应该没问题。只需确保您包含jquery.js 之前 jquery.ui.js 并且控制台中没有错误
猜你喜欢
  • 2012-03-15
  • 1970-01-01
  • 1970-01-01
  • 2011-10-25
  • 2017-05-02
  • 2021-10-25
  • 1970-01-01
相关资源
最近更新 更多