I have a select
with some options
. But this select section is not always shown. It is only shown if a user has clicked another element. If the user submits the form than the default values (first entries) of the select are also submitted. How can I clear the select value?
I tried it with $('#ExpM').val('')
and also with this:
$('#Form').submit(function() {
if (!$('#radio_dump').is(':checked')){
$('#ExpM').selectedIndex=-1;
$('#ExpY').selectedIndex=-1;
}
});
But the values are also sent in the post. These values are not required. What can I do?