Home › Forums › General Issues › If a field is empty (doesn\'t have any value), do something with plain Javascript › Reply To: If a field is empty (doesn\'t have any value), do something with plain Javascript
I don’t mind using PHP, i am just not familiar with the language.
Could you provide me with a code snippet?
I am imagining something like this in JS:
if( field_name = ‘ ‘){
document.querySelector(‘.video–title’).classList.add(‘hidden’)
}
———-
CSS
.hidden {
display:none;}
———–
For the JS part, I don’t know how to implement that the field returns nothing. Probably the way i wrote the code is wrong.
I would appreciate your help, even in PHP.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚀 ACF & ACF PRO 6.0.7 are now available.
— Advanced Custom Fields (@wp_acf) January 18, 2023
✨This release contains bug fixes and improvements while we continue to work on the next major release of ACF.https://t.co/wQgAOpwmUI
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.