I am currently using the following jquery code to help hide fields based on values from another field:
<script rc="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$("select[title='Col1']").change(function() {
if ($("select[title='Col1']").val() == "Option 1")
{
$('nobr:contains("Test Header")').closest('tr').hide();
$('nobr:contains("Date")').closest('tr').hide();
}
else
{
$('nobr:contains("Test Header")').closest('tr').show();
$('nobr:contains("Date")').closest('tr').show();
}
});
});
</script>
What I need now is how to get this applied if the default value is 'Option 1'. For example: If the New Form opens and Col1 says 'Option 1' I would want Test Header and Date columns to be hidden.
I also need this on the Edit Form. So whatever was chosen in the New Form, the same hidden or not-hidden fields should carry over to the Edit Form.
});at the end.