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
jquery
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
Best Answer
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