I want to get key name from my html element?
Sample code :
<td data-code="123">220</td>
Using jquery data method I am able to key value but I want to extract key name?
var keyValue=$("td").data("code"); //123
var keyName=?????
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.
data-code would be the key for that.
If you want to get the keys for unknown key/value pairs you can use a
for (var key in data) {}loop: