Show/Hide #SharePoint columns in a List based on selected values in a drop-down list:
<script language="javascript" type="text/javascript">
$(document).ready(function() {
showhide();
$("select[title='FieldName']").change(function() { showhide(); });
});
function showhide()
{
alert("inside function");// just to debug script , remove while move in production
var thisVal = $("select[title='FieldName']").val();
alert(thisVal);// just to debug script , remove while move in production
if (thisVal=="Somevalue")// your condition
{
alert("show all");// just to debug script , remove while move in production
$('nobr:contains("FieldName")').closest('tr').show();
}
else
{
alert("inside else");// just to debug script , remove while move in production
$('nobr:contains("FieldName")').closest('tr').hide();
}
</script>
No comments:
Post a Comment