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

141
Views
Establecer atributo de datos con js nativo

¿Cómo configuro un atributo de datos con js nativo para que se recoja con jquery? Intenté usar setAttribute , pero eso solo funciona la primera vez y no se recogen las actualizaciones:

 var iframeHolder = document.getElementById('test'); iframeHolder.setAttribute('data-test', 5); var $iframe = $('#test'); console.log($iframe.data('test')); iframeHolder.setAttribute('data-test', 6); // this doesn't seem to update the underlying data attribute console.log($iframe.data('test')); iframeHolder.dataset.test = 6; // neither does this console.log($iframe.data('test'));
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div id="test">inspect to see attribute updates</div>

Tenga en cuenta que necesito usar js nativo ya que está en un iframe que no usa jquery (pero establece el atributo de datos en la ventana principal que usa jquery)

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!