I'm using jQuery v1.4.4. I have a very simple form:
<select class="myselect" name="myselect">
<option value="-1" selected="selected">N/Av</option>
<option value="-2">N/Ap</option>
<option value="0">Available</option>
</select>
What I want to achieve is set the value to 0
(Available
) and disable the select. So I do the following:
$('.myselect').val('0');
$('.myselect').prop('disabled', true);
The output is correct: Available
is being selected and the select is disabled. When I submit the form however, the value of $_POST['myselect']
is -1
. When I only use...
$('.myselect').val('0');
... the value of $_POST['myselect']
is 0
as expected.
So my question: is there a way to disable myselect
and still set the value?