Example http://jsfiddle.net/Rg8rf/
$("#label").change(function() {
var src = $(this).data('value');
alert(src);
});
How do I grab a value from data-value?
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.
this in that case means the select list, so you have to catch the selected value inside “this”. This will work for you:
Its very easy to test in this cases if you are not sure and don’t get the value of what you expected. Inside the change method you could just write console.debug(this) and look in the console to see whats inside, or just alert($(this).attr(“id”))