Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

88
Views
Hide Profile Field if User Meta is blank - Wordpress

Good evening everybody!

I'd like to hide a profile field if the user meta is blank.

For example, in the image, I'd like to hide the billing_ateco row because billing_ateco field is empty.

enter image description here

I have no idea where to start, if you have the solution or suggest me one similar thread (I didn't find anything in the similar questions section when I posted this) It would be a great help, thanks in advance!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If by user meta you mean user input, one approach would be to find all input elements, check if their value is empty and then hide their parent tr element.

// Find all <input> elements:
document.querySelectorAll("input").forEach( input =>{
  // Check to see if the value is empty:
  if ( input.value.trim() === "" ){
    // Find the closest <tr> parent of the input and 
    // hide it:
    input.closest("tr").style.display = "none";
  }
});
<table>
  <tr>
    <td>
      <label for="a">Label A</label>
    </td>
    <td>
      <input id="a" />
    </td>
   </tr>
  <tr>
    <td>
      <label for="b">Label B</label>
    </td>
    <td>
      <input id="b" />
    </td>
   </tr>
  <tr>
    <td>
      <label for="c">Label C</label>
    </td>
    <td>
      <input id="c" value="Value" />
    </td>
   </tr>
</table>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!