I’m trying to add multiple jQuery data entries to a single element.
I suspected that the following would work
jQuery('td.person#a'+personId).data('email',thisPerson.email).data('phone',thisPerson.phone);
However, I am getting nothing but errors when I do this.
jQuery('td.person#a'+personId).data('email',thisPerson.email);
jQuery('td.person#a'+personId).data('phone',thisPerson.phone);
is there another way to get more than one data entry on an element? Hopefully chained?
You can pass an object into
.data(), like this (broken so to prevent horizontal scroll)To answer your question though, yes it should be chainable, if you post what errors you were getting that would help see why it isn’t working.