Q:

Basic jQuery .data() call returns 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...

A:

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")

FIDDLE

