I need to remove all attributes set on certain elements with jquery, except for a few i want to select manually. Lets say i have an image:
<img hspace="4" border="1" vspace="4" src="someimage.jpg" alt="somealt">
and i want this as result:
<img src="someimage.jpg" alt="somealt">
the only way i could think of is the .removeAttr() every single attribute. But the problem is that some times there is a style="balbla" set, i want to remove or other attr's that maybe i forgot. So i want to white list the attrs that are ok and remove all the others.
how would you do this?