Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2012
    Posts
    60
    Thanks
    65
    Thanked 0 Times in 0 Posts

    remove one property in an inline style

    Hi

    How do I remove "display: none;" from this in line style

    I have tried this
    Code:
    $('table tr').removeAttr('style');   // That removes all inlines but I want width
    $('table tr').css('display','');  // set display to nothing
    
    <table>
    	<tr style="display: none; width:300px;">
    	  <td>test 1</td>
    	  <td>test 1</td>
    	  <td>test 1</td>
    	</tr>
    </table>

    ultimately I need to make the tr show but display block makes the "tr tds " loose its auto spacing on fire fox

    thanks

  • #2
    Senior Coder
    Join Date
    Jan 2005
    Location
    Memphis, TN
    Posts
    1,785
    Thanks
    8
    Thanked 131 Times in 129 Posts
    if you just want to remove the display none, you could use:
    Code:
    $('table tr').show();
    That sets the element to display block.

    If you have something more specific, you could use:
    Code:
    $('table tr').attr('style', $('table tr').attr('style').replace(/display: ?none;/g, ''));
    That would allow you to remove something really specific, eg:
    Code:
    $('table tr').attr('style', $('table tr').attr('style').replace(/border-left: ?1px solid #444;/g, ''));
    Stop making things so hard on yourself.
    i is tugbucket :: help raise tugburg :: Whitehaven Kiwanis

  • Users who have thanked harbingerOTV for this post:

    code-in-time (06-13-2012)

  • #3
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,883
    Thanks
    56
    Thanked 539 Times in 536 Posts
    Quote Originally Posted by code-in-time View Post
    ultimately I need to make the tr show but display block makes the "tr tds " loose its auto spacing on fire fox
    display:table-row is the equivalent of "block" to maintain table formatting

    https://developer.mozilla.org/en/CSS/display

  • Users who have thanked xelawho for this post:

    code-in-time (06-13-2012)

  • #4
    New Coder
    Join Date
    Mar 2012
    Posts
    60
    Thanks
    65
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by xelawho View Post
    display:table-row is the equivalent of "block" to maintain table formatting

    https://developer.mozilla.org/en/CSS/display
    is that cross crowser?

  • #5
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,883
    Thanks
    56
    Thanked 539 Times in 536 Posts
    generally yes - see the table on the link I sent.

    although there is always IE - 7 and below does not support it, apparently (I don't have that version to test). 8 and above with proper doctype.

  • Users who have thanked xelawho for this post:

    code-in-time (06-13-2012)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •