The URL to the page is this .
And the screenshot to the questioned area is this .
I want, if the accordion has no content, then hide the accordion title itself. Empty accordion elements won't show.
I have used this script for that:
jQuery(".su-spoiler-content:empty").parent().hide();
But I can't find it doing anything.
Is there anything wrong in the above code?
try that...
document.querySelectorAll('div.su-spoiler-content').forEach(xDiv=>
{
if (xDiv.innerText.trim() === '')
xDiv.closest('div.su-spoiler').style.display = 'none'
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.