I have one div in html and I want to set image and its margin property at runtime. I written following code in JavaScript file but the css class 'air' cannot be apply to image. In class air I set its margin style like {10px 10px 10px 10px}
If changing the class is all what you need, it's better that you assign an id to the image element, and change the class Class of this element can be simply changed with jquery as below:
Replacing the whole image element in order to change the class is using atom bombs to crack walnuts. Just change the class on the existing element as shown above.