Jack Harrington Jack Harrington - 1 year ago 52
jQuery Question

Override a 'left' style value using Jquery or Javascript

So the following is in my DOM:

class="quoteItemEditorView partType_MATERIAL editMode selectorEnabled"
style="left: -1px; right: 0px; width: auto; min-width: 480px; display: block;"

I am able to retrieve the element and replace the 'left' value however this is proving difficult. I have tried doing this through jquery and javascript via following methods but it wont over ride.

$("#itemEditor").css('style','left','400px !important');

document.getElementById("itemEditor").style.left="400px !important";



Any suggestions

Answer Source

You should do it like this using jQuery's css() method:


jQuery css() gets the value of a computed style property for the first element in the set of matched elements or set one or more CSS properties for every matched element.

Hope this helps!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download