Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery Set Multiple Attribute for the Elements</title> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("img").attr({ "class" : "frame", "title" : "Hot Air Balloons" }); }); }); </script> <style> .frame{ border: 6px solid #000; } </style> </head> <body> <button type="button">Set Attributes for Image</button> <p> <img src="/examples/images/balloons.jpg" alt="Hot Air Balloons"> </p> </body> </html>