How to remove all inherited and computed styles from an element?
问题 The page has the following CSS: input[type=text] { display: inline; padding: 7px; background-color: #f6f6f6; font-size: 12px; letter-spacing: 1px; border: 1px solid #aac7d1; /* lots of other styles here... */ } I have many text-input elements and the following: <input type="text" id="txt1" /> And I try to apply different styles to this individual textbox (txt1) via jQuery: $('#txt1').removeClass().removeAttr('style').css({ 'background-color': '#ff0000', //lots of other styles here... }); But