1

I have a requirement to show three text boxes and make them mandatory on check of radio button else hide the text boxes.

I am able to show hide in New and Edit form. But on Disp read form I am not able to show hide text boxes on radio button check or uncheck:

<script src="//code.jquery.com/jquery-3.2.1.min.js" type="text/javascript"></script>
<script type="text/javascript">

$(document).ready(function() {

   $('nobr:contains("Description )")').closest('tr').hide();
   $('nobr:contains("Causes )")').closest('tr').hide();
   $('nobr:contains("Immediate)")').closest('tr').hide();
   //$('input:radio').change(function(){
   $('input:radio').on('change', function() {
      if($("span[title='Line of fire']>input").is(":checked")){
          $('nobr:contains("Description )")').closest('tr').show();
          $('nobr:contains("Causes )').closest('tr').show();
          $('nobr:contains("Immediate )")').closest('tr').show();
      }
   });
  });

function PreSaveAction() {
var jq = jQuery.noConflict();
var txtTitle1 = jq(":input[Title='Description ']").val();
var txtTitle2 = jq(":input[Title='Causes ']").val();
var txtTitle3 = jq(":input[Title='Immediate']").val();
var r =(jq("span[title='Other']>input").is(":checked"));
if((txtTitle3 == "")&& r === true){
alert("Please enter Immediate)");
return false;
}

else{

return true;

}
}
</script>