Set a key/value object as properties to all matched elements. This serves as the best way to set a large number of properties on all matched elements.
Example:
Sets src and alt attributes to all images.
$("img").attr({ src: "test.jpg", alt: "Test Image" });
HTML:
Result:

No comments:
Post a Comment