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

242
Views
Quiero ocultar una ventana emergente basada en la identificación del cliente y usar el almacenamiento local html5

Soy bastante nuevo en todo esto, pero aquí tenemos mi problema. Tengo una ventana emergente que tiene una casilla de verificación "no mostrar esto de nuevo". Cuando un usuario marca esto, el almacenamiento local debe guardar la identificación del cliente (que está en la base de datos) y el estado marcado de la casilla de verificación. Según estos dos factores, la ventana emergente debe mostrarse u ocultarse

Aquí está mi código:

 $(document).ready(function () { $('#beforelight').css('display', 'block'); $PopUp = $('#beforelight'); var hide = JSON.parse(localStorage.getItem('hide')); var id = JSON.parse(localStorage.getItem('[[clientdb.id]]')); if (hide, id) { $PopUp.hide(); } else { // initialize value in case it hasn't been set already localStorage.setItem('hide', false); } $('#checkbox').click(function () { $('#beforelight').hide(); // toggle the boolean by negating its value var id = JSON.parse(localStorage.getItem('[[clientdb.id]]')); var hide = JSON.parse(localStorage.getItem('hide')); localStorage.setItem('hide', !hide); }); });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Pruebe este código: JSON.parse devuelve una cadena

 $(document).ready(function () { $('#beforelight').css('display', 'block'); $PopUp = $('#beforelight'); var hide = JSON.parse(localStorage.getItem('hide')) === 'true'; var id = JSON.parse(localStorage.getItem('[[clientdb.id]]')); if (hide && id) { $PopUp.hide(); } else { // initialize value in case it hasn't been set already localStorage.setItem('hide', 'false'); } $('#checkbox').click(function () { $('#beforelight').hide(); // toggle the boolean by negating its value var id = JSON.parse(localStorage.getItem('[[clientdb.id]]')); var hide = JSON.parse(localStorage.getItem('hide')) === 'true'; localStorage.setItem('hide', !hide ? 'true' : 'false'); }); });
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!