I'm trying to use JavaScript to add an image dynamically, but I want to remove it when the viewport is 600px or wider.
This is my approach so far:
var img = document.createElement('img');
// (imagine here all the other fields being defined).
img.style='My @media rule here';
Unfortunately, this method didn't work. Is there a different way I should be attempting this?