I use an externel javascript file and i have this,
function getdropdownvalue()
{
alert($("#<%=DLState.ClientID%>"));
}
but it doesn’t seem to get my dropdown’s clientId… Any suggestion…
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
And is that dropdown in your external JavaScript file? If it’s an external .js file, it has no idea about the fact that you may have a dropdown somewhere else on the internet.
You need to pass the ClientID in from the page where you reference the JavaScript.
.js file:
or the jQuery way:
.aspx file (after including your external JS):
By the way, if you just want to get the value of the dropdown,
$("...").val()works quite fine.