I have an a div with position:absolute. I’m trying to position it to right using jQuery but it’s not working. In the code below i’m basically removing left and adding right:0. This should position the div to far right. using firebug, i can see the inline style being changed to right:0 but nothing is happening. What am i doing wrong. Check http://jsfiddle.net/SJP3b/1/
$('div').css({
left: '',
right: 0
});
Use
left:'auto'that works for me:http://jsfiddle.net/SJP3b/2/
Many values can’t be set to blank.
So you have to set them to their default css value.
That’s
autofor theleftattribute:http://www.w3schools.com/css/pr_pos_left.asp