Reputation: 682
I have a bootstrap modal having id myModal
.
In my javascript when i do something like
window.onload = function(){
var container = document.getElementById("myModal");
console.log(container.clientWidth);
}
It shows 0
.
How to get the clientWidth of a Bootstrap modal before it is opened?
Upvotes: 0
Views: 952
Reputation: 2419
Jquery width
works just fine
$('#ModalName').find('.modal-dialog').width()
For $('#ModalName')
you are always getting wrong value.
Upvotes: 1