how to change size of image js 1

how to change size of image js

var image = document.getElementById('id');
image.style.width='imgWidth';
image.style.height='imgHeight';

Here is what the above code is Doing:
1. It’s getting the image element by its id.
2. It’s setting the width and height of the image to the values of the variables imgWidth and imgHeight.

Now, let’s add the above code to our script.

Similar Posts