Here is the following HTML:
<div style="visibility: hidden;">
<span id="myId" data-recipientId="2"></span>
</div>
Here is the jQuery:
var recipientId = $("#myId").data("recipientId");
I noticed that recipientId
is always undefined...
Here is the following HTML:
<div style="visibility: hidden;">
<span id="myId" data-recipientId="2"></span>
</div>
Here is the jQuery:
var recipientId = $("#myId").data("recipientId");
I noticed that recipientId
is always undefined...
data attributes are lowercase.
$("#myId").data("recipientid")
It would be more correct to use this:
<div style="visibility: hidden;">
<span id="myId" data-recipient-id="2"></span>
</div>
and
$("#myId").data("recipientId")