I am trying to style the DIV using javascript. If the user clicks the DIV, it will dynamically change the value of the property passed after onclick. I want to try this in order to save my code that's why I chose jquery css. But, the property is not working. Is this possible or is there any other way to make it happen? thanks
<script>
function changeProperty(mine , property , value){
$(mine).css({ property : value }); //if I change the property to 'background' for example, it works properly, but I want property to remain so that i will not be changing the property from time to time
}
</script>
<div onclick="changeProperty(this, 'background', 'red');">
change background
</div>
<div onclick="changeProperty(this, 'font-size', '15px');">
change font size
</div>
<div onclick="changeProperty(this, 'font', 'Arial');">
change font
</div>
✔button.