javascript - 我的网站在更改焦点时出现意外行为

标签 javascript html css

我正在使用 Knockout.js 库和 jQuery 开发 Web 应用程序。最初的形式是这样的: Init form

对于每个输入数据,在更改焦点时,我的表格高度增加,如下图所示: After onchange focus

在我的表格的 HTML 代码下面:

<table style="width:100%;">
        <col width="25%" />
        <col width="25%" />
        <col width="50%" />
        <tr>
            <td>
                <span id="spnMaintenanceLastDate" class="Description">TEXT</span>
            </td>
            <td>
                <input id="dtpMaintenanceLastDate" class="DatePicker" data-bind="value: shopViewModel.lastMaintenanceDate" />
            </td>
            <td>
                <span id="spnMaintenanceDescription" class="Description">TEXT</span>
            </td>   
        </tr>
        <tr>
            <td>
                <span id="spnConcept" class="Description">TEXT</span>
            </td>
            <td>
                <select id="slcConcept" data-bind="value: shopViewModel.conceptId" style="width:100%"></select>
            </td>  
            <td rowspan="2">
                <textarea id="MaintenanceDescription" style="height:100%; width:100%; margin-right: 5px;" data-bind="value: shopViewModel.maintenanceDescription"></textarea>
            </td>
        </tr>
        <tr>
            <td>
                <span class="Description">TEXT</span>
            </td>
            <td>
                <select id="slcFlooringType" data-bind="selectedOptions: shopViewModel.flooringTypes" multiple="multiple" style="width:100%"></select>
            </td>
            <td></td>
        </tr>
        <tr>
            <td colspan="3">
                <hr class="hr" />
            </td>
        </tr>
    </table>

你能帮帮我吗? 谢谢

注意:使用 Internet Explorer 8 我没有这个问题,使用现代浏览器我有这个问题。

最佳答案

您可能必须专门设置 <td> 的垂直对齐方式元素类似于 vertical-align:top因为这似乎是默认行为 vertical-align:baseline .

尝试添加该 css 规则/样式。

关于javascript - 我的网站在更改焦点时出现意外行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27981483/

相关文章:

CSS - 盒子阴影技巧?

javascript - 调试时源映射是否有效?

javascript - 数组重复javascript

javascript - 哪一个更快? `array.findIndex` 与 `array.reduce` + `object[index]`

javascript - 删除 javascript 随文本返回的标签

html - CSS - 制作小型居中响应式 youtube 视频

javascript - 使用 AJAX 和 JQuery 动态操作 JSON API 数据

javascript - 拦截所有鼠标事件

css - Bootstrap 3 : What is the correct way to resize the top-fixed navbar height to below 50px?

css - 使用类覆盖 wordpress 中的 CSS