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

67
Views
Ocultar sección cuando no hay mensajes para mostrar

Necesito ocultar el div cuando no hay mensajes para mostrar, Javascript se usa para mostrar los mensajes. He intentado soluciones a preguntas similares sin éxito.

HTML:

 <div class="msgList"> <section id="messages"> <h2>Messages</h2> <ul id="users-messages"> </ul> </section> </div>

JavaScript:

 // Display messages in list const messageSection = document.getElementById('messages'); const messageList = messageSection.children[1]; const newMessage = document.createElement('li'); newMessage.classList.add('msg-List'); newMessage.innerHTML = `<a href="mailto:${user_email.value}">${user_name.value}</a>. <span id="msg-span"> wrote: ${user_message.value}</span>`;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede usar condicional para user_message.value . Agrega el estilo de mostrar ninguno a su sección de mensajes si user_message.value es nulo o está vacío.

De lo contrario, puede configurar el HTML interno como una cadena vacía si no hay ningún mensaje.

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!