无法使用 jquery 的 .css() 在 mozilla 和 IE 中获取边框属性

Not able to fetch border properties in mozilla and IE using jquery's .css()

在我的 table 中,我使用下面提到的 tr 并使用样式给边框。

<tr id="test"  name="test1" style="border: 2px solid !important">

同时使用 jquery

 $(this).css('border-bottom')

returns chrome 中的适当值,但在 mozilla 和 IE 中不适用。我也尝试了许多 shorthand 属性,例如 borderStyleborderBottomWidth, borderBottomColor 但没有成功。

请告诉我哪里做错了。

  1. 首先,你的htmltable不完整。 重要。
  2. 当您的 css 被浏览器读取时,border: 2px solid #000; 被解释为多个特定属性。您需要定位特定的 css 属性,例如:border-bottom-width

$(document).ready(function(){
    var border1 =  $('#test').css('border-bottom-width');
    alert(border1);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
    <tr>
        <td id="test" style="border: 2px solid #000 !important;">sdsds</td>
    </tr>
</table>