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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.