I need to access the div with class formErrorContent inside the div with id emailMsg without putting ID attribute for the inner div. How can I achieve that?
<div id="emailMsg" class="formError" style="opacity: 0.80; margin-top: 0px;display:none;" onclick="this.style.display='none';">
<div class="formErrorContent">* This field is required<br>
</div>
</div>
Use the class selector.
This could also be written this way;
.. depending on which works best for you.
If you can guarantee that
.formErrorContentwill always be a child, consider usingchildren()and the child selector instead.