Tuesday, October 2, 2012

Retrieve items count from dropdown list using javascript


var cntSel = document.getElementById(‘<%=ddl.ClientID%>’);
if (cntSel.length > 1)
{
if (document.getElementById(‘<%=ddl.ClientID%>’).value == ’0′)
{
alert(‘Select Dropdown..’);
document.getElementById(‘<%=ddl.ClientID%>’).focus();
return false;
}
}
cntSel.length – by this you can find the dropdown contains items or not.

No comments:

Post a Comment