Click here to Skip to main content
15,886,783 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i have 20 drop downs in my page.

how to get drop down id in Jquery
Posted

var DropDownID = Document.getElementById('<%= YourDropDownName.ClientID %>');
 
Share this answer
 
Comments
vr reddy 15-Sep-14 3:10am    
hello, i have 21 dropdown in my page. how to send particular name
Thanks7872 15-Sep-14 3:11am    
id is something that uniquely identifies element. e.g. drp1,drp2,drp3.....
RAHUL(10217975) 15-Sep-14 3:11am    
What Name?? Dropdown name ?? or selected text name??
vr reddy 15-Sep-14 3:19am    
dropdown name and selected text also
JavaScript
// try this code
//it will get all dropdown and their values, you can use according to your requirements. 
$("select").each(function(e,i){   alert(e+$(i).val()); });

//e: it will be index of dropdownlist
//i: it is current dropdownlist

//here is code for id
$("select").each(function(e,i){   alert(e+$(i).attr("id")); });//it will get each dropdown index and id


-> M.U
 
Share this answer
 
v3
Comments
vr reddy 15-Sep-14 4:16am    
i want dropdown id
MuhammadUSman1 15-Sep-14 4:21am    
Check solution i have update code for id. it will get each dropdown id also.
vr reddy 15-Sep-14 4:21am    
thnaku
MuhammadUSman1 15-Sep-14 4:22am    
Welcome
vr reddy 15-Sep-14 4:33am    
ok but i want get dropdown id in dropdown changed
JavaScript
//get id on change of dropdownlist.
$("select").change(function()
  {
   alert(this.id);
  }
);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900