Data attribute becomes integer
jquery
Solution
Try
$('#a').append($('#a').attr('data-siteid'));
$('#b').append($('#b').attr('data-siteid'));
From the jQuery Docs
Every attempt is made to convert the string to a JavaScript value (this includes booleans, numbers, objects, arrays, and null) otherwise it is left as a string. To retrieve the value's attribute as a string without any attempt to convert it, use the attr() method.
Problem
Check out this simple example on jsfiddle ``` <div id ="a" data-siteid="00005">00005 turns into:</div> <div id="b" data-siteid="S00005">S00005 turns into: </div> ``` code ``` $('#a').append($('#a').data("siteid")); $('#b').append($('#b').data("siteid")); ``` result ``` 00005 turns into:5 S00005 turns into: S00005 ``` I would like to return "00005" and "S00005".