JSFiddle - React, Tailwind, and code Playground
HTML
<div id="yourdiv">
blabla
<img src="http://blog.stackoverflow.com/wp-content/uploads/stackoverflow-logo-300.png" title="StackOverflow">
blabla
</div>
CSS
div div {
border: 1px solid red;
}
JavaScript
$("#yourdiv img").each(function() { //Loops through the images in a specific div. $(this) represents the current image in the loop
$(this).addClass("yourclass"); //Add a class
$(this).wrap("<div>"); //Add a wrapping div
$("<p>").text($(this).prop("title")).insertAfter($(this)); //Create a new paragraph with the title property of the image as text and put it after the image (inside our newly created div)
});