Sharepoint - Hide/Show columns in Custom List based on dropdown selection

Your code should be worked, Just one note If you are using SSL, so you should use the HTTPS JQuery reference.

The below code should work

<script type="text/javascript">
$(document).ready(function(){
   $('nobr:contains("Project Subtype")').closest('tr').hide();  
    //Show/hide columns based on Drop Down Selection 
   $("select[title='Project Type']").change(function() {
 if ($("select[title='Project Type']").val() != "Other") 
   {
     $('nobr:contains("Project Subtype")').closest('tr').hide();
   } 
 else 
   {
     $('nobr:contains("Project Subtype")').closest('tr').show();
   }
   });
});
</script>

Output

enter image description here


For more details, Please check

  • Show / Hide fields based on choice field selection using JQuery in SharePoint.
  • Show and hide fields based on a Choice field selection in ‘New Form’, ‘Edit Form’ and ‘Display Form’ in SharePoint 2013 / 2016 via SPUtility.js?

Tags:

Jquery

Cewp