I have 10 Dropdowns in sharepoint list. Intially i want to show only one Drop down in the newform.aspx . Once the user selects a value in the dropdown i want to show another dropdown.
I was able to get the first part sucessfully i.e( Hididng the other dropdowns).But on change event of the dropdown is not working fine. Can you please let me know if my code is correct.
$(document).ready(function(){
CheckDropdown("Drop1","Drop2");
CheckDropdown("Drop2","Drop3");
});
function CheckDropdown(Drop_Column,Hide_Column)
{
var DropDownColum=$("select[title='"+Drop_Column+"']");
if ($("select[title='"+Drop_Column+"']option:selected").text() == "")
{
HideColumn(Hide_Column,"True");
}
else
{
HideColumn(Hide_Column,"False");
}
DropDownColum .change(function() {
if ($("select[title='"+Drop_Column+"']option:selected").text() == "")
{
HideColumn(Hide_Column,"True");
}
else
{
HideColumn(Hide_Column,"False");
}
});
}
function HideColumn(Column,IsHide)
{
if(IsHide=="True")
{
$('nobr:contains("'+Column+'")').closest('tr').hide();
}
else
{
$('nobr:contains("'+Column+'")').closest('tr').show();
}
}
</script>
0 commentaires:
Enregistrer un commentaire