I’m getting an empty string if I try to log the value of the last element in a div…
let bES = $('#content').children().last().val()
console.log(bES)
>Solution :
Probably, you need to use text() instead of val()?
const val = $('#content').children().last().text();
console.log(val);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="content">
<p>Text 1</p>
<p>Text 2</p>
<span>Last element</span>
</div>