Failed to get border properties in mozilla and IE using jquery.css ()

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

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

      

When using jquery

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

      

returns matching values ​​in chrome, but not in mozilla and IE. I have also tried many shorthand properties like borderStyle , borderBottomWidth , borderBottomColor but no luck .

Please tell me what I am doing wrong.

+3


source to share


1 answer


  • First of all, your html table is not complete. It is important.
  • When your css is read by the browser, it is border: 2px solid #000;

    interpreted for a few specific properties. You need to target a specific css property like: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>
      

Run codeHide result


+3


source







All Articles