Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

132
Vistas
It shows this error when there is no local storage: Uncaught TypeError: Cannot read properties of null (reading 'style')

I want to make cross button invisible when there is no localStorage.

HTML

<h1><span>History</span><span id="clear" onclick="clearall()">&times;</span></h1>

JS

document.getElementById("clear").style.display="none";
}

function clearall(){
if(confirm("Delete all "+localStorage.length+" calculations?")){
localStorage.clear();
}
}```
7 months ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos