I've got this :
$('.something').css({ 'margin-left' : '100px'});
Sometimes it needs to be changed to this :
$('.something').css({ 'right' : '100px'});
So I've been trying to put this in a string var as follow :
var css_prprty = 'margin-left';
if(change_needed){
css_prprty = 'right';
}
$('.something').css({ css_prprty : '100px'});
It fails.
And for some reason it seems logical that it does, but I can't think of a way to resolve this.
Anyone know what would be the proper way to use a variable value in this case ?