I want to update a text box when a drop down is either select to Yes or No. The code I have checks it the is an option for Y or N. How to I check which value is selected?
html
<select id="SelectionFlag" name="SelectionFlag">
<option value="">Select one</option>
<option selected="selected" value="Y">Yes</option>
<option value="N">No</option>
</select>
jquery
$("#SelectionFlag").change(function () {
var currentYear = (new Date).getFullYear();
alert(currentYear + 1);
if ($("#SelectionFlag").value = "N") {
$("#TermDate").val("12/31/" + currentYear);
}
if($("#SelectionFlag").value = "Y")
{
$("#EffectiveDate").val("12/31/" + (currentYear + 1));
}
});
Change your IF statements to:
and