Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

489
Vistas
Agregar opciones dinámicamente, seleccionadas y no seleccionadas

En este código quiero inyectar opciones. ¿Cómo puedo pasar eso usando la función de inject ? Pasar también en caso de que ya esté seleccionada alguna opción.

 dynamic_form.inject([{ p_name: ['One','two'], quantity: '123', remarks: 'testing remark' }, { p_name: ['One','two'], quantity: '123', remarks: 'testing remark' }]);

Esta parte de JSON es un poco confusa

 $.each(formValue, function(index, value) { if ($.isArray(value)) { mainForm = clone.find("#" + index); if (typeof mainForm.get(0).getSource === "function") { $.each(value, $.proxy(fillData, mainForm.get(0).getSource())); } } else { var formElements = changeArray[formIndex].find("[origname='" + index + "']"); if (formElements) { if (formElements.get(0).tagName.toLowerCase() == "input") { /* Fill in radio input */ if (formElements.attr("type") == "radio") { formElements.filter("[value='" + value + "']").attr("checked", "checked"); } else if (formElements.attr("type") == "checkbox") { /* Fill in checkbox input */ formElements.attr("checked", "checked"); } else { formElements.attr("value", value); } } else if (formElements.get(0).tagName.toLowerCase() == "textarea") { /* Fill in textarea */ formElements.text(value); } else if (formElements.get(0).tagName.toLowerCase() == "select") { /* Fill in select */ $(formElements.get(0)).find("option").each(function() { if ($(this).text() == value || $(this).attr("value") == value) { $(this).attr("selected", "selected"); } }); } } } });
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda