Toni Michel Caubet
Toni Michel Caubet

Reputation: 20163

Setting display: block !Important

There is a problem with a rollover doesn't want to show its content and if I do

#callCenter {
    position: fixed;
    z-index: 2411 !important;
    display: block !important; /* please note here !important */
    right: 110px;
}

It's shown, but if I do: (so the div is hidden until another element is clicked)

#callCenter {
    position: fixed;
    z-index: 2411 !important;
    right: 110px;
}

And

$('#telefonosCabecera').click(function(){
    $("#callCenter").css('display','block!important'); // or 'block !important'
    alert('done')
});

I don't see #callCenter but I do see the alert.

What could be the reason for this?

Upvotes: 14

Views: 54957

Answers (1)

Phoenix
Phoenix

Reputation: 1276

You need to do one of the following:

  1. Add a class with the !important rule (i.e.: .myClass{display:block !important;} ) and then add the class to the element
  2. Add the css attribute via $('#myElement').attr('style','display: block !important');

Upvotes: 34

Related Questions