I am having a simple issues with this example and getting the “a is null” in the Firefox error console. No alert shows. If I change from a DOM element to a object it works?
<!DOCTYPE html>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function() {
$('<div>').attr('id', 'test').appendTo('#ii').text('dfdfd');
$('#test').data({'rr': 'data', 'tt': 55});
alert($.param($('#test').data()));
});
</script>
<html>
<head>
</head>
<body>
<div id="ii"></div>
</body>
</html>
It looks like you meant to get the data from
#testrather than#ii:Example
If this is not working it is likely that an element with the id
#iidoes not exist.