I'm trying to dynamically change the css properties of a jquery masonry plugin box.
Essentially, I'm going to make the box expand, i've this code, but it yields no results.
$container.click(function(){
var elem = document.getElementById($container);
elem.style.width="500px";
});
I expect for the width of the block to change to 500px when I click on it, but it doesn't.
Any insight on dynamically changing css via javascript would be great. Thanks!
$container
is a string, which it must be if thatgetElementById()
call is going to work. Why are you usinggetElementById()
anyway in jQuery code? – Pointy Jul 21 '12 at 14:36