I have created 5 dropdowns in mvc razor view using foreach
. I need to do validation if same value gets selected in more than one dropdown in jquery.
I can easily do it using the dropdown id
but what if I have more number of dropdown which is created dynamically?
Is there any generic code/way to do this?
</div>
@Html.DropDownList("drdId"+count, new SelectList((ViewData["MYList"] as List<MYDATA>).Select(t => new { Value = t.Id, Text = t.Name }), "Value", "Text"))
</div>
I tried like
function test(){ var arr = new Array($("#count1").val(),$("#count2").val(), $("#count3").val(), $("#count4").val()); for(var i=0; i
how do I make array arr dynamic for more number of dropdowns?