Reset value of a select field with jQuery/Boostrap

Asked

Viewed 946 times

3

Hello, how can I reset a select field?

<label for="IDSelect">Campo</label>
<select data-live-search="true" title="--" name="NAMESelect" id="IDSelect">
    <option value="1">Valor 1</option>
    <option value="2">Valor 2</option>
</select>

Note that the default value when loading the page is "--", I want that after selecting an option and submitting this form (submerged with jquery), return to the default value "--"

  • When you write that "the default value when loading the page is "--"" gives me the idea that you are using a plugin for selects. That’s the case? which one?

  • I’m wearing bootstrap

  • Can you mount a jsFiddle with an example? Boostrap is using the title attribute as an option?

  • 2

    can, wait a few minutes I’m riding, and I don’t use very well

  • Okay, check it out: https://jsfiddle.net/t0u1j6L8/1/

1 answer

1


  • It worked, thank you very much!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.