I have a jquery where I did a console.log(ui). When I inspected my browser I got an object in the attached image
stop: function (event, ui) {
console.log(ui);
}
I want to be able to retrieve that number after div# highlighted
in yellow in the image. How can I retrieve just that number and
pass to a javascript method?
Ok here you go. If you get html from console.log(ui.helper[0]) you can retrieve easily.
Example:
var str = '<div class="draggable position-absolute ui-draggable obstacle" id="9" style="left: 441.25px; top: 179.25px;">'; // get from ui.helper[0]
var raw = $(str);
var result = raw.attr("id");
console.log(result);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>