CoryDorning CoryDorning - 6 months ago 23
jQuery Question

jQuery data() and 'changeData' event

I'm trying to figure something out. I can add a

event to an HTML element and have the click event update the

This would then trigger the
$(document).bind('changeData', function() {...}))
. Knowing this, what would be the best way to find out which HTML element updated

Any help is appreciated.


$(document).bind('changeData', function {
// get the anchor that set $(document).data()

$('a').click(function() {
$(document).data('key', 'value');


Well for the data by click event:

    $(document).data(key, val);

$(document).bind('changeData', function(e){

If not, try storing the target within the data stored:

    $(document).data(key, {
        val: 'value',

Then when you have the change event:

$(document).bind('changeData', function(e){
    var data = $(this).data(key);
    var target =;
    var value  = data.val;