Remove attributes "height" and "width" of the image tag

alienlebarge picture alienlebarge · Jun 13, 2012 · Viewed 20k times · Source

In order to create a responsive website with Typo3 and Twitter Bootstrap, I would like to remove the height and width attributs of images

Here's how images are generated in Frontend via content element of type text & image and image

<img src="typo3temp/pics/a625b79f89.jpg" width="300" height="226" alt="blabla" />

I would like to remove the dimension attributes and get this:

<img src="typo3temp/pics/a625b79f89.jpg" alt="blaba" />

Can anyone help me ?

Answer

Sundar picture Sundar · Jun 13, 2012

Call an image tag in document.ready function.

$('img').removeAttr('width').removeAttr('height');