Hello
Help solve the task.
Add on the top button, and then 6 paragraphs with any text and images in them, one under the other. When you click on the button among all the images found for the odd, perform text extraction and assign this text to the corresponding lower/even paragraph and move the odd elements 40 pt to the left.
I know how to do part with text and it works, but how to do it with both text and images?
<button class="execute">Go!</button>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Optio, quos?</p>
<p>Lorem ipsum dolor sit amet.</p>
<p>Lorem ipsum dolor, sit amet consectetur adipisicing.</p>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Ducimus commodi vitae laborum itaque odio nihil dolores eveniet aut rerum eos!</p>
<p>Lorem, ipsum dolor.</p>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Consequatur, porro.</p>
var el = $("p");
$(".execute").click(function() {
el.each(function(i, value) {
if ((i + 1) % 2 == 1) {
$(this).css("padding-left", "40pt");
el[i + 1].innerText += ' ' + value.innerText;
}
});
});
2