Issue
I am just posting a little example because the code is big
This is in the function
const[Municipios, setMunicipios] = useState("");
const cargarMunicipio = function(e){
const opcion = e.target.value;
setMunicipios(opcion);
console.log("Municip", opcion)
}
//This is in render
<select name="categorias" id="setCategorias" onClick={cargarMunicipio} className="inputt3"
required>
{
idDepartamentos >= 0 &&(
departamentos[idDepartamentos].ciudades.map((item,i)=>(
<option key={i} value={item}> {item}</option>
))
)
}
</select>
Solution
It was the onClick, the correct event was onChange and then worked in desktop and android browsers.
Answered By - dialac
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.