We have all built applications in Lotus Notes where we use the value of a checkbox, radio button or dropdown box to show or hide additional fields, like you can see in this clip.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
$(document).ready( function () { // Check value and do initial show/hide after page is finished loading refreshRecommendations(); // Set trigger for click on radio button to call function $("input[name='Recommendations']").click( function() { refreshRecommendations(); }); }); function refreshRecommendations() { var checked = $('input[name=Recommendations]:checked').val(); if (checked == "n/a") { $("#ReasonNA").show(); $("#ReasonNALabel").show(); } else { $("#ReasonNA").hide(); $("#ReasonNALabel").hide(); } }
If you want to check the value if a checkbox, use $(“#checkboxID”).is(“:checked”) and to check the value of a dropdown box, use $(“#dropdownboxID”).val(). For the dropdown box, use .change() instead of .click(), otherwise the code is identical.
$("#Section1").fadeOut(750, function() { $("#Section2").fadeIn(500, function() { alert("Done."); }); });