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

202
Views
Datos adicionales del activador Select2

Estoy tratando de cargar datos adicionales en mi selección (select2), pero el Evento desencadenante no está cargando los datos adicionales. El código y los resultados se muestran a continuación.

 $('#section').select2(); var data = { id: 1, text: 'text_default', anothertext: 'text_2' }; var newOption = new Option(data.text, data.id, true, true); $('#section').append(newOption).trigger('change'); //until this point, everything works $('#section').trigger({ type: 'select2:select', params: { data: data } }); console.log($('#section').select2('data')[0]['text']);// return text_default console.log($('#section').select2('data')[0]['anothertext']);// return undefined console.log($('#section').select2('data')['anothertext']);//only for test, return undefined console.log($('#section').data('anothertext'));//only for test, return undefined

¿Hay algo mal con el código?

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!