Been tinkering with some code regarding setting the visibility of a drop down based on the selected value of another dropdown.
This code is for the page load:
$(document).ready(function() {
if ($("#<%=ddlCoverage.ClientID %>").val() == 'Basic') {
$('#CoverageType').show();
}
else{
$('#CoverageType').hide();
}
});
Here is the the other piece that I use for the changing of the dropdown.
$("#<%=ddlCoverage.ClientID%>").change(function() {
$('#CoverageType')[($(this).val() == 'Basic') ? 'show' : 'hide']()
});
Is there a better way to write this?