Let's consider a scenario:
There is an image nested inside an introductory div
for the desktop layout, like so:
<div class="intro">
<img id="gambar" src="assets/images/image-intro-desktop.jpg" alt="">
</div>
Now, when the viewport size changes to mobile, the img
tag needs to be updated to:
<img id="gambar" src="assets/images/image-intro-mobile.jpg" alt="">
The question at hand is how to achieve this component change and what JavaScript code is required?