Good afternoon, I'm developing a modal in pure javascript.
What happens is the following ... the script detects that there are tags with the "modal" class <div class="modal">
, and when it finds one or more it inserts the tags with the already defined classes.
What happens ... one of the functions inserts a div within this div with the following class <div class="modal loading"></div>
and in that way it enters as one more item inside the javascript loop.
Is there any way to select only the modal that does not have another class inside?
I'm using this call in my javascript
var modal = document.getElementsByClassName('modal');
modal[i].innerHTML = "<div class='modal loading'></div>"
My CSS is this way.
.modal>.loading {
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 10%;
background: url(loader.gif) center no-repeat;
}