show div if any content exist in the div
Sun Feb 11 2024 21:21:10 GMT+0000 (Coordinated Universal Time)
Saved by
@Y@sir
#div
#show-and-hide
// Get all elements with the class "jet-form-builder-file-upload__content"
2
var fileUploadContentDivs = document.querySelectorAll('.jet-form-builder-file-upload__content');
3
4
// Iterate through each div
5
fileUploadContentDivs.forEach(function (div) {
6
// Check if the div has any content
7
if (div.innerHTML.trim() !== '') {
8
// If content exists, display the div
9
div.style.display = 'block';
10
} else {
11
// If no content, hide the div
12
div.style.display = 'none';
13
}
14
});
15
content_copyCOPY
show div if any content exist in the div
Comments