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

142
Views
How can I hide a div with cookies?

I want to hide a div by pressing a submit button which will add to the client a cookie. I have tried many ways but till the moment I haven't figured out how can I do it. Here is my JavaScript & HTML to try. HTML code + CSS:

<div class="postulacion" id="formulario">

    <span class="s_no foca">¿Estás interesado?</span>
    <span class="s_n"> ¡Rellene el siguiente formulario!</span>

    <div class="formulario">
        <span class="recuerde">   <i class="fas fa-lock"></i> Recuerde que toda su información se encuentra encriptada.      </span>

CSS Code:

.formulario.hidden{
   display: none !important;
}

JavaScript code:

$.cookie('_dro', 'the_value');

// Create expiring cookie, 7 days from then:
$.cookie('_dro', 'the_value', { expires: 7 });

// Read a cookie
$.cookie('_dro'); // => 'the_value'
$.cookie('not_existing'); // => null



$("#form_send").click(
    $.cookie('_dro', 'the_value', { expires: 7 }));



if (document.cookie.indexOf('_dro') > -1) {
    
        $('.formulario').addClass('hidden');
    
}
else {
    
        $('.formulario').removeClass('hidden');

    
}
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!