I am working with a dropdown list that is inside a datagrid. I am binding data to the dropdown list using a dataset. Here is the use case: I select a particular value in a dropdown list from the next row onwards and I select the same value in the other rows of the dropdown list, which causes a messa开发者_Python百科ge to be displayed.
How do I achieve this by using javascript?
Assuming that each dropdown has a unique ID specified: <select id="dropdown1">
etc:
var dd1 = document.getElementById('dropdown1');
var dd2 = document.getElementById('dropdown2');
if(dd1[dd1.selectedIndex].value == dd2[dd2.selectedIndex].value)
{
alert("Dropdown 2 is the same value as dropdown1 !!!");
}
精彩评论