I am doing this:
var sId=id.toString(); var index=sId.substring(3); var mrg=index*221; var el=$(id); el.css('margin-left',mrg+'px'); and el.css('marginLeft',mrg+'px');
el is the element i want to set the margin to (correctly retrieved) and mrg is the value of the new margin
If i do $('#test1').css('margin-left',200);
or $('#test1').css('marginLeft',200);
it works in both ways, it's something wrong with the way i set the property.
The correct way is var el=$('#'+id);
log("margin="+margin+" padding="+padding); } var elem = $("div. header"); //set the element to inspect logMarginPadding(elem); //sets elem. css("margin","10px"); elem. css("padding","10px"); logMarginPadding(elem); })(jQuery);
css() Incrementing margin-left property Increments the margin-left property. Example: css("margin-left", "+=50px") - Move the mouse over the <h1> elements to increment the margin-left property. $(document). ready(function() { $("h1").
try
el.css('margin-left',mrg+'px');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With