Ver Mensaje Individual
  #4 (permalink)  
Antiguo 03/04/2009, 12:41
zodgyy
 
Fecha de Ingreso: febrero-2008
Ubicación: Mexico, D.F.
Mensajes: 23
Antigüedad: 16 años, 2 meses
Puntos: 0
Respuesta: seleccionar option de select

tengo esta funcion espero te funcione..

function Mantener(nomObj,valor){

$(':input').each(function() {
//var name = this.name
var type = this.type
var id = this.id

if(id==nomObj){

if(type=='select-one'){ //Select
//Recorre los options
$(nomObj).each(function(){
if($(nomObj+" option").val()==valor){
$(nomObj+" option").attr("selected","selected");
}
});
}

if(type=='radio'){ //Select
//Recorre los elementos
$(nomObj).each(function(i){
if($(this).val()==valor){
$(this).attr("checked","checked");
}
});
}

if(type=='checkbox'){ //Select
//Recorre los elementos
$(nomObj).each(function(i){
if($(this).val()==valor){
$(this).attr("checked","checked");
}
});
}
}
});
}

solo la poner despues te tu select por ejemplo:

<select id="lista">
<option value="">Seleccione</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<script>
Mantener('lista','<? echo $arrQuery['xxx'];?>');
</script>

espero te sirva...