Hello
How can i add ID='xyz'in IMG tag

<div class="main-banner">
<img width="1000" height="242" alt="cropped-Penguins.png" class="attachment-full" src="http://../cropped-Penguins.png">
</div>

JQuery which i have tried

jQuery('.main-banner').append("img").attr('id','xyz');

But Not Work.
Give me suggestion
Thank you

$("img").attr("id","xyz");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.