Here's the code snippet I'm working with:
var showThis = $(this).attr('id'); // div0, div1, div2 etc.
$('#' + showThis).attr('style', 'background-color: #063 !important, height: 520px');
I am trying to modify the background-color, width, and height of
#showThis
using the above method since adding or switching classes breaks other parts of my code. The current code successfully changes the background-color and height, but not the width. Adding
width: 20px
at the end does not work as expected. It doesn't throw any JavaScript errors and still changes the background-color, but fails to change both the width and height. What could be causing this issue?
Please note that I must use the !important tag (meaning .css instead of .attr is not an option) and I am using Internet Explorer 8 and CSS (not CSS3).