Here is how to alert and also display an attribute / attr of an element. In this case we are outputting the 'title' attribute but you can substitute for your attribute of choice:-

Ad You might find this useful
Rize
Maximize Your Productivity with Rize AI

Rize is an AI productivity coach that uses time tracking to improve your focus and build better work habits. It is available for macOS and Windows.

With the Slick Media Promo (click promo link bottom right), you can get a 25% discount on your first three months of Rize.

RizeRize
Maximize Your Productivity with Rize AI
Promo Save on Rize
Ad You might find this useful
Surfshark
Award Winning VPN Deal

Become invisible online with Surfshark VPN and protect your online presence with: -

100 VPN Server locations
Alternative email generator
Data breach alerts
Malware protection
Tracker and ad blocker

SurfsharkSurfshark
Award Winning VPN Deal
Promo Save on Surfshark
$(document).ready(function() {
var title = $("a img").attr("alt");
alert(title);
$("#show-alt").text(title);
});

Example of how to output the title attr of image

A beautiful landscape

The Alt 'attr' of the image (A beautiful landscape) is displayed below

Ad You might find this useful
Loom
Record your screen to communicate better

Loom is the fastest way to record quick videos of your screen. It's easy to use and perfect for hybrid workplaces. FREE & affordable paid plans.

LoomLoom
Record your screen to communicate better
Promo Save on Loom
Ad You might find this useful
Wavebox
Wavebox is the revolutionary browser you should be using Now!

Be more productive with apps, tidy tabs, multi-account sign-in, unified search, flexible workspaces, and more...

Get 35% OFF with the Slick Media Wavebox Promo Code (click promo link bottom-right)

WaveboxWavebox
Wavebox is the revolutionary browser you should be using Now!
Promo Save on Wavebox
A beautiful landscape