How do I change an element's style
property using jQuery?
This is the HTML code I am working with:
<div id="template" style="width:200px; height:200px; border:none;">blabla...</div>
I attempted to do this:
$('#template').attr('style', '...');
And also tried this:
$('#template').prop('style', '...');
However, both methods did not work as expected.
Is there a correct way to achieve this in jQuery?
UPDATE: My intention is not to update the whole style of the element. Rather, I want to directly replace the value of the style
attribute.