How can I set the default value with a javascript function?
<select id='tipoDocumento'
name='tipoDocumento' class='select2-container select2me form-control'>
<option value=''>Seleccionar</option>
<?php
foreach ($tipoDocumento as $i=>$descripcion){
if ($_POST['tipoDocumento']==$i){
echo "<option value ='" . $i ."'selected>". $descripcion ."</option>";
}else{
echo "<option value ='" . $i ."'>". $descripcion ."</option>";
}
}
?>
</select>
The select
I fill it with data from a base that I have, but I can not put with a button that in the onclick
call a function, the value of Select as when the page is just loaded.
Thank you very much!