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

131
Views
Visualización de la imagen de entrada del usuario al sitio web

Estoy creando una aplicación de redes sociales. Recibí la entrada de imagen del usuario, pero estaba atascado al mostrar la imagen.

Aquí está mi archivo HTML

 <form id="form"> <div id="closeForm"><i class="fas fa-window-close"></i></div> <label> <p>Enter the title:</p> <input id="newTitle" placeholder="Art Title" type="text"> </label> <label> <p>Select your image:</p> <input id="newImg" class="imgInput" accept="image/*" type="file"> </label> <input id = "formBtn" type="button" acc value="Upload"> </form>

Este es mi archivo JS

 document.getElementById('formBtn').onclick=()=>{ let newTitle = document.getElementById('newTitle').value; let newImg = document.getElementById('newImg').value; let fragment = ` <img class="art_img" src="${newImg}" alt="" srcset=""> <p id="title">${newTitle}</p>`; artContainer.innerHTML+=fragment; }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Utilice el objeto FileReader para crear un blob y adjuntarlo al elemento.

Ejemplo:

 const reader = new FileReader(); reader.onload = (e) => { imgElm.src = e.target.result; }; // do some checks to make sure its not empty reader.readAsDataURL(input.files[0]);
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!