how can i delete the value of each select option
element except the second option
value :
<select name="_users_id_requester" onchange="submit()">
<option value="0">-----</option>
<option selected="" value="774">Asmaa El Habib,Yassine</option>//except this one
<option value="779" title="Ahlam Edouiri - U8K8O">Ahlam Edouiri</option>
<option value="746" title="Ainane Mohamed - MohamedAinane">Ainane Mohamed</option>
</select>
i have tried some thing like this but i don't know how to end it :
$("select[name='_users_id_requester']").each(function(){
if ( $(this).index() > ..... )
$(this).attr("value", " ");
});
You can go like
$("select[name='_users_id_requester'] option").not(":eq(1)").val('');
$("select[name='_users_id_requester'] option").not(":eq(1)").prop('value', '');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With