I have the following div <div data-item-id="0234">
and when I try to access the data with $element.data("itemId")
jQuery converts it to int and now i get 234
instead of "0234"
. Is there any way i can get the actual data "0234"
?
Simply use .attr
instead ($element.attr('data-item-id');
). The docs themselves suggest this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With