I have an each loop in which each looped element has the following html structure:
<li>
<p>Text</p>
<form>...</form>
</li>
In the loop I create a <span> element, which I want to insert in each looped element between the <p> and the <form> element. But I don't know how to access the elements within this, I just know how to insert it at the beginning (prepend) and end ('append') of the li, but not between the <p> and <form>.
Here is my code:
function calculation(elements) {
$(elements).each(function() {
...
var output = $('<span>').addClass('durationValue').html('Some Values..');
$(this).append(output);
});
}