Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding CSS style with jquery has no effect

I am trying to check in the AJAX call if length of the response variable is bigger then 1. If that is true I need to add this style to my footer:

success: function(response) {
    for (var i = 0, len = response.results.length; i < len; i++) 
        {
            if(response.results.length>1)
            {
               $("#footer").css("position:relative");
            }
        }....
}

This is my predefined style in my css file:

#footer
    {
        z-index:11;
        bottom:0;
        position: fixed;
        float: left;
        width:100%;
        height:30px;
        background-color:black;
    }

I did some debugging and everything is working as it should be working but my footer element still has position:fixed

What am I doing wrong in here?

like image 554
user123_456 Avatar asked Aug 13 '26 03:08

user123_456


1 Answers

Try:

$("#footer").css("position", "relative");

or:

$("#footer").css({ position: "relative" });

:)

like image 76
karim79 Avatar answered Aug 15 '26 15:08

karim79



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!