sandy
sandy

Reputation: 1155

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

In my table I am using below mentioned tr and giving border using style.

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

While using jquery

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

returns appropriate values in chrome but not in mozilla and IE. I tried many shorthand properties as well such as borderStyle, borderBottomWidth, borderBottomColor but no success.

Please tell me what I am doing wrong.

Upvotes: 3

Views: 58

Answers (1)

Muhammet
Muhammet

Reputation: 3308

  1. First of all, your html table is not complete. It matters.
  2. When your css is read by browser, border: 2px solid #000; is interpreted to multiple, specific properties. You need to target a specific css property, for example: 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>

Upvotes: 3

Related Questions