JavaScript Tutorial

.attr()

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("img").attr("width", "500");
  });
});
</script>
</head>
<body>
    <img src="img_pulpitrock.jpg" alt="Pulpit Rock" width="284" height="213"><br>
    <button>Set the width attribute of the image</button>
</body>
</html>