Dreamweaver creates a self-closing tag when it inserts an image (and maybe elsewhere). How do I stop this outdated behavior? Example:
<img src="images/updated.gif" width="87" height="12" alt="Updated"/>
That closing slash causes a validation warning. Thanks.
By @Fred Brack
Some tasks aren't configurable from preferences, but if you want to remove the IMG ending slash luckly DW's architecture, which dates back to Macromedia, is still fairly flexible.
At least as far as dialog boxes (all in HTML) and commands (all in Javascript) are concerned, so the user interface remains accessible, one can still adapt and modify as one likes.
However, don't forget to always make a security copy, just in case...
- Quit DW
- Open the folder
C:\Program Files\Adobe\Adobe Dreamweaver 2021\Configuration\Objects\Common
- Locate the file Image.js file (that is where you have to make a backup copy)
- Open it with a NotePad++ editor (avoid NotePad, especially not WordPad, etc.)
- You should encounter a string of type
rtnStr = rtnStr + 'alt="' + '"/>';
- Just delete the ending slash
rtnStr = rtnStr + 'alt="' + '">';
- Save and close the file
- Restart DW,
- Now, when you insert the image from the main menu, the slash should have disappeared in the code