For those using ASP.NET MVC,
Needing to move the modal div just before the </body>
tag but can't do it because you are using a Layout page
Define a section in you _Layout.cshtml
file just before the body tag, eg:
... some html in layout page ...
@RenderSection("bottomHTML", required: false)
</body>
</html>
Then in your view
@section bottomHTML
{
<div class="modal fade" id="myModalID" role="dialog" tabindex="-1" aria-labelledby="demo-default-modal" aria-hidden="true">
... rest of the modal div HTML ...
}
This way, the modal HTML will be rendered before the body tag and the modal now should be displayed correctly..