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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.