As part of our web design tips and tactics guide, here is a sometimes useful javascript technique of hiding broken images and their ALT text. This can be useful ( as a quick, temporary fix) when pulling from another source such as a dynamic array or a database output which may have a few broken paths. This can also be used as a bulletproofing technique for interface design as a temporary solution when dealing with tricky image sources.
<img src="#" alt="I WANT TO HIDE THIS WHEN THE IMAGE IS BROKEN" onerror="this.style.display='none'">
Here is the snippet:
onerror="this.style.display='none'"
The onerror event is supported in all major browsers.
Ironpaper, Webintel:
SUBJECT: web design guide
by Jonathan Franchell, CEO of Ironpaper - For more tips and hacks: Need to remove a new line after h1 tags? Both web designers and SEO practitioners need to employ headline tags: H1, H2, H3 in several ways to improve web page structure and tag...
The Crowded Arena of the IT Marketplace Updated December 2024 The Information Technology (IT) landscape is experiencing rapid growth and intensifying competition. IT spending is projected to reach nearly 5.1 trillion U.S. dollars in 2024, a...
by Jonathan Franchell, CEO of Ironpaper - For more tips and hacks: For iOS app developers, there are some annoying parts of the development process that many developers just hate. For one, only one person can be nominated to be Team Agent on Apple's...
Marketing healthcare technology presents unique challenges that differ significantly from other industries. The complexity of medical products, the stringent regulatory environment, and the diverse needs of healthcare providers create barriers that...