2015-01-16 38 views
2

我正在用Knockout.js庫和jQuery開發Web應用程序。最初的形式是這樣的: Init form我的網站在更改焦點上的意外行爲

的foreach輸入數據,有變化的重點,我的表增加高度,就像下圖: 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我沒有這個問題,我用現代瀏覽器有這個問題。

+0

你能爲我們的模擬提供一個可用的http://jsfiddle.net/嗎? –

+0

請提供您隨css標記一起提供的內容。 –

回答

0

您可能必須將<td>元素的垂直對齊方式專門設置爲vertical-align:top之類的內容,因爲這似乎是默認行爲vertical-align:baseline

嘗試添加該css規則/樣式。

0

這個問題似乎與高度和垂直對齊。就像@mOchia所說的,vertical-align應該夠了,但爲了安全起見,我建議使用百分比並添加一個height屬性。