Wednesday, November 16, 2016

Checking selected value in all dropdowns using jquery

Below code works if you have multiple drop downs where you want to check the selected value in all drop downs  in the form and see if this value is selected already, if selected then will show an alert message and change the selected value of that particular drop down

Add the "OnChange" in dropdown events as this onchange="ChkCurrent(this);
where 'id' is current value dropdown
 function ChkCurrent(id) {   
            var ddlValues = new Array();
            $("[id*='ddlstsCurrM']").each(function (i) {
                if ($(this).val()== 1) {

            if (ddlValues.length > 1)
                alert("This value has been already selected");
                var ddlid ="#";


No comments:

Post a Comment