Why doesn't this script return the modified element?
The element is indeed changed in the function but not correctly returned.
<script>
x = "<div></div><div></div><div></div><p></p>";
function modify (x) {
$(x).find('div').each(function(index){
$(this).html('content text');
$(this).addClass('test') ;
});
return $(x);
}
modify (x);
</script>