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

92
Views
Variables de campo de entrada de autocompletar de Javascript

¿Cómo puedo usar un valor de un campo de entrada de autocompletar en un segundo campo de entrada?

Escribí este script a continuación, pero no sé cómo usar las variables del primero en el segundo campo de entrada. las respuestas del primer campo: [{"label":"TEST","value":1}] y necesito el "valor" para el segundo campo...

 $(document).ready(function(){ jQuery('#first-field').autocomplete({ source:'', minLength: 2, delay:0, select: function(event, ui) { event.preventDefault(); $("first-field").val(ui.item.label); }, focus: function(event, ui) { event.preventDefault(); $("#first-field").val(ui.item.label); } }); jQuery('#second-field').autocomplete({ source:'', minLength: 2, delay:0, select: function(event, ui) { event.preventDefault(); $("second-field").val(ui.item.label); }, focus: function(event, ui) { event.preventDefault(); $("#second-field").val(ui.item.label); } }); });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Prueba esto

 <label for="FirstField">First Name</label> <input id="FirstField" /> <br /> <br /> <label for="SecondField">Second Name</label> <input id="SecondField" /> $(function() { $('#FirstField, #SecondField').autocomplete({ source: [ "Some Name", "Value", "Place" ], minLength: 0, select: function( event, ui ) { $('#SecondField').val(ui.item.value); $('#FirstField').val(ui.item.value); return false; } }) .focus(function() { var self = this; window.setTimeout(function() { if (self.value.length == 0) $(self).autocomplete('search', ''); }); }) $('#FirstField').change(function() { $('#SecondField').val($(this).val()); }); });
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!