currently I am working on an image slider with jquery. I have downloaded the code from the net. My code demo is here.
My question is: how can I remove the height and width attaching dynamically to image tag as inline style?
Thanks.
Try to use this code:
$('your-image').css({ 
  width: '',
  height: ''
});
If you want to set the "original" image dimensions try this:
$('your-image').css({ 
  width: 'auto',
  height: 'auto'
});
                        You can do it with vanilla JavaScript too.
let articleContentImages = document.getElementById("articleContent").getElementsByTagName("img");
for(let i = 0; i < articleContentImages.length; i++){
    articleContentImages[i].style.height = "auto";
    articleContentImages[i].style.width = "auto";
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With