Reputation: 109
I have to change a display: none;
to a display: block
. I'm having troubles and I can't get it to work..
I have to change this:
.colorbox #content,.colorbox #nav,.colorbox #header,
.colorbox #service,.colorbox #footer,
.colorbox #disclaimer{display:none}
with JQuery to a display: block
.
Actually I have to change it only in the ID #footer
.
I tried with:
$('.colorbox #content,.colorbox #nav,.colorbox #header, .colorbox #service,.colorbox #footer, .colorbox #disclaimer').css('style', 'display: block !important');
or with:
$('.colorbox #content,.colorbox #nav,.colorbox #header,.colorbox #service,
.colorbox #footer,.colorbox #disclaimer').css("display", "block !important");
or with:
$('#footer').css("display", "block !important");
I'm actually loading a css file from a external website.. (HTML also) Is it possible, that I can't access with a single JQuery method to this files to change their values ?
How can I make it ?
Upvotes: 0
Views: 174
Reputation: 665
If your #footer has style display: none, than use:
$( "#footer" ).css( "display", "block" )
And remove important tag from css as well.
Upvotes: 0
Reputation: 7675
You can do it many ways. The following are four easy way:
$("#footer").hide();
CSS:
.force_hide{
display: none !important;
}
jQuery:
$("#footer").addClass('force_hide');
style
instead of css
:$("#footer").style('display', 'none', 'important');
css
then use it like following:$("#footer").css("cssText", "display: none !important;");
Upvotes: 1
Reputation: 297
$("#id").css("display", "none");
$("#id").css("display", "block");
or
$('#id').hide();
$('#id').show();
or
$("#id").css({display: "none"});
$("#id").css({display: "block"});
For class you can give it as:
$(".class").css("display", "none");
Upvotes: 1