var selector = $(this);
What is the proper code to change the custom attribute data-change-me for selector?
The syntax
selector[data-change-me='someValue'];
Is not working for me
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.
I think you want the attr method.
Here’s the documentation: http://api.jquery.com/attr/
It’s worth pointing out also that it looked like what you were trying to do was treat the jQuery wrapped DOM object as a Javascript object e.g:
Look at the following example for what I mean:
This is valid syntax for pure Javascript objects but not jQuery. To learn about Javascript I recommend Javascript the good parts