Limit dragable area?

Hello, I created an application and added a JQuery library for https://jqueryui.com/sortable/ , Its working fine except for one thing. If I drag an item, I can drag it for all the browser making the error of expanding the Window size, is there a way to limit an area where I can drag an item?, I check this jquery instruction but Im not sure how to use it:
( source: https://forum.jquery.com/topic/limit-draggable-area-ui )
$(‘#draggable’).each(function(){
$(this).draggable({
containment: $(this).parent().parent()
});
});

Will I need to create an additional jquery component that act as a container? or is there a way to ‘inject’ the instruction like the CSS Injection, or exist another way? , I checked other users asking similar questions but whitout a correct answer .

Thank you in advance.