Impostazione di un singolo attributo
$("img").attr("src", "/images/banner.jpg.webp");
Impostazione di un singolo attributo (con funzione)
$("div").attr("id", function (arr) ( return "div-id" + arr; ))
Impostazione di più attributi
$("img").attr(( src: "/images/banner.jpg.webp", title: "banner", alt: "banner" ));
Ottenere attributo
var $source = $("img").attr("src");