Hiding field <div> if value is blank

Hey All, I am using a plugin called WC Fields Factory which allows me to add custom fields to my woocommerce products and without seeing the plugin, I do not know if this can be answered.

If I have 3 inputs like Make, Model, Serial. Is there a way to hide the fields on the frontend if they are blank.

I contacted support and the only response I received was “Yes it is possible using small JavaScript snippet” , which I do not know where or what to add.

Is there a general snippet that can be used to accomplish this?

Question:
How are you supposed to see (unhide) the fields to type information into
if they are not seen (blank) to begin with? What are you using as an event to unhide the fields?

Clarification possible?

I have fields in the backend that I fill out to show on front end, I want it to where if the forms are not filled out (bank) then they do not show on the front end.

With blank you mean they don’t have a value attribute set? Then you might try the following CSS:

input[value=""],
input:not([value]) {
  display: none;
}
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.