Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

228
Vistas
print text when button is pressed

A fellow noob here. I was wondering how can I make this button print something when pressed, I tried the document.write() but it prints it on a new clear page, I want it to be just like the image I attached. Any ideas :D

  <button onclick = "myVidPlayer.requestPictureInPicture()" " Id="togglePipButton" 
   >START</button>

enter image description here

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

If you are refering to print as write to DOM element or console use below code:

const someData = 'the_Data_You_Want_To_Print'

document.getElementById('printButton').onclick = function() {
  //print in DOM element
  document.getElementById('printHere').innerHTML = someData;
  //print on console
  console.log(someData)
};
#printHere {
  position: absolute;
  top: 15%;
  left: 6%;
  font-size: 5vw;
 }
<button id="printButton">Click Me To Print</button>

<p id="printHere"></p>

about 4 years ago · Juan Pablo Isaza Denunciar

0

You could use an alert window.

alert("Hello! I am an alert box!!");

or something like this:

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Alert</h2>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
  alert("I am an alert box!");
}
</script>

</body>
</html>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda