Why do you need to use JavaScript to get the contents?
In Mendix, the box will be an attribute of an entity, so you can get the value using a microflow or nanoflow.
If you do need JavaScript, you could get a nanoflow to call a JavaScript action.
https://docs.mendix.com/howto/extensibility/write-javascript-actions
For Javascript action, you can implement them by a microflow.