primera vez, cuando me carga la página, mi caja de selección está vacía:JQuery Mobile: ¿Cómo volver a procesar el cuadro de selección?
<select name="secondaryTitle" id="secondaryTitle"></select>
Entonces hago llamada AJAX y obtener los datos JSON para arriba caja de selección.
arrtitle = objSecTitle.getAllSecondaryTitle(serviceId); // its an ajax call, that returns json object
var obj = jQuery("#secondaryTitle");
removeAllOptions(obj);
for(i=0;i<arrtitle.length;i++)
{
obj.options.length=obj.options.length + 1;
obj.options[obj.options.length - 1].text = arrtitle[i][1];
obj.options[obj.options.length - 1].value = arrtitle[i][0];
}
function removeAllOptions(selectbox){
var i;
for(i=selectbox.options.length-1;i>=0;i--)
{
selectbox.remove(i);
}
}
Mi llamada de ajax es perfecta. El código anterior también cambia los elementos desplegables. Pero la interfaz de usuario no se actualizará cuando usemos jQuery Mobile, ya que muestra/oculta diferentes div para la ventana emergente de selección.
OMG esto me llevó mucho tiempo para encontrar! He intentado todo por días ahora. ¡Gracias! –
debe usar mejor .trigger ('crear') – TecHunter