-2
I have a form, and when I click "Redo Search" I want it to clear all fields.
HTML?
<form action="" class="">
<ul class="dropdown">
<li>
<input type="checkbox" <?php echo (in_array($dadosSegmentos->idAdicional, $_GET['segmentos'])) ? 'checked' : ''; ?> id="<?php echo $dadosSegmentos->descricao; ?>" name="segmentos[]" value="<?php echo $dadosSegmentos->idAdicional; ?>" />
<label for="<?php echo $dadosSegmentos->descricao; ?>"><?php echo $dadosSegmentos->descricao; ?></label>
</li>
</ul>
<select class="estados" name="estado">
<option value="">UF</option>
<option value="">UF1</option>
<option value="">UF2</option>
<option value="">UF3</option>
<option value="bla"></option>
</select>
<input class="formInputBusca grid_150" placeholder="Informe a cidade" value="<?php echo ($_GET['cidade']!='' && $_GET['cidade']!='Informe a cidade') ? $_GET['cidade'] : 'Informe a cidade'; ?>" name="cidade" type="text" />
<input type="reset" class="buscaAvancadaRefazer f-left margin-top-20" value="Refazer Busca" />
<input type="submit" value="" class="buscaAvancadaBt f-right margin-top-20 cp" />
</form>
used the type="reset"
, But he cleans the inputs.
in select, I would like it to leave selected the first <option>
, Is there a way? When the guy tells him to redo the search he cleans the input
and switch to the first option
giving the impression of a new search.
What is happening when you clean? By the test I did with your code, the option
UF
, which is the first, is being selected. That’s not it?– Paulo Rodrigues
I took the test here and it’s okay!
– Marconi
So, I’ll update the answer, have more options, eheh, I was wrong, it’s pulling by php here
– Felipe Viero Goulart
i want it back to the first value even after the user has selected another
– Felipe Viero Goulart
@Felipestoker has some specific browser, the code is still working.
– Marconi
Here also works all right.
– Jorge B.