There is an HTML element written as follows:
<div class="cart-button js_button" data-pp-config="{"billingAgreementFlow":true,"locale":"en_US","style":{"size":"small","color":"gold","shape":"pill","label":"checkout","tagline":"true"},"env":"sandbox","createPaymentUrl":"https://url?isAjax=true"}">Button</div>
And when I hit the following two in the console I always get the correct data:
1. $(".js_button").data('ppConfig')
2. $(".js_button").data('pp-config')
I am confused, I mean I can't understand how can the above two be same, I have used 2nd multiple times, and I know that always works and before trying the 1st one, I thought this is how we fetch the data
attribute.
But I can't understand why the 1st one works, I was going through someone's code and this annotation took a lot of time to understand. I also want to know, why does jQuery provide more than one methods of fetching the same data attribute, is one better over the other?
This question might appear silly, I am wondering how does the two ways fetch me the same and correct data set?
Thanks in advance.