<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
body {
font-size: 12px;
}
div {
float: left;padding-left: 10px;
}
img {
border: 1px solid #CCCCCC;
padding: 3px;
float: left;
}
</style>
<script src="../js/jquery-3.5.1.js"></script>
<script>
$(function () {
var strAlt = $("img").attr("src");
strAlt += "<br>" + $("img").attr("title");
$("#divAlt").html(strAlt);
})
</script>
</head>
<body>
<img alt="这是一幅风景画" title="这是一幅风景画" src="images/img01.jpg">
<div id="divAlt"></div>
</body>
</html>