Adding CSS style with jquery has no effect

css, html, javascript, jquery

Solution

Try:

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

or:

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

:)

Problem

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?

Original source