javascript - How to hide element using Class; instead of using css function in JQuery? -
there multiple times datatables used in solution.
at 1 place got requirement need hide data table header:
<div id="doctable_wrapper" class="datatables_wrapper no-footer"> <div> <div class="datatables_scroll"> //following top div of head generated dynamically datatables <div class="datatables_scrollhead nodisplay" style="overflow: hidden; position: relative; border: 0px none; width: 100%;"> <div class="datatables_scrollheadinner" style="box-sizing: content-box; width: 1188px; padding-right: 16px;"> <table class="datatable no-footer" role="grid" style="margin-left: 0px; width: 1188px;"> <thead id="docheading"> </thead>
i have added style named nodisplay in datatables_scrollhead.
it contains :
nodisplay{ display:none !important; }
i applying in jquery as:
$(".datatables_scrollhead").addclass("nodisplay");
when run code header not hide. in firebug able see style name. in firebug, when try apply class div below it; not getting applied.
in firebug, when use inline style display:none in style tag. hides.
but when used
$(".datatables_scrollhead").css('display', 'none');
it worked.
why?
as per standards not suppose use .css , use addclass only. please me in doing same using addclass?
perhaps typo in css?
your css:
nodisplay{ display:none !important; }
your forgot . :
.nodisplay{ display:none !important; }
Comments
Post a Comment