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

216
Views
¿Cómo mostrar una imagen de un archivo de entrada dentro de un iframe?

Estoy tratando de crear un editor de texto enriquecido sin marcos y quiero ingresar imágenes en el cuadro de texto, que es un iframe. ¿Cómo muestro la imagen dentro del cuadro de texto con solo abrirlo?

Eso es lo que tengo hasta ahora:

 //Show Image in Text Box function showImg() { const textBox = document.getElementbyID("textBox"); const imgFile = document.querySelector("input[type=file]").files[0]; textBox.onload = function(e) { const image = document.createElement("img"); image.src = e.target.result; document.body.appendChild(image); } textBox.readAsDataURL(imgFile); }
 iframe { border: 0; width: 100%; margin-bottom: 5pt; height: 250pt; } .fas { color: #f85991; font-size: 50pt; } .hidden { display: none; }
 <!-- Input File --> <div class="hidden"> <input type="file" name="imageUpload" accept="image/*" id="imageUpload"> </div> <!-- Image Button --> <label for="imageUpload" title="Inserir Imagem"> <i class="fas fa-image"></i> </label> <!-- Text Box --> <iframe name="richTextField" id="textBox" contenteditable="true"></iframe> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v6.0.0/css/all.css">

about 4 years ago · Juan Pablo Isaza
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!