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

127
Views
Agregue un conteo a JS simple para evitar que se repita

Estoy tratando de agregar un conteo simple al siguiente JavaScript con la esperanza de que solo se realice una vez, idealmente incluso en la actualización de la página, pero el formulario podría recargarse con ajax:

 jQuery(document).on('gform_post_render', function () {
 if (jQuery("#input_51_1").val().length > 0) {
 jQuery('form#gform_51').trigger('submit');
 } else {
 // Do nothing
 }
});
almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puede usar localStorage como una variable de bandera

Primero verifique si el elemento en localStorage está configurado con getItem , y si no está configurado con setItem

 jQuery(document).on('gform_post_render', function () {
 if (!localStorage.getItem('gform_post_renderEventTriggered')) {
 localStorage.setItem('gform_post_renderEventTriggered', true);
 if (jQuery("#input_51_1").val().length > 0) {
 jQuery('form#gform_51').trigger('submit');
 } else {
 // Do nothing
 }
 }
});
almost 4 years ago · Santiago Trujillo 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!