I have:
<td data-X="1,2">
and when I do:
var Y = $('td').data('X');
Z=Y.split();
it works.
But if I have:
<td data-X="1">
then it doesn’t work.
At least I think that’s what’s happening. I’m getting “Y.split is not a function”, but only sometimes.
.data()is smart. It tries to use a more appropriate type thanstringfor the value – in your case, it’snumber.From the docs: