JQuery - Javascript - .hasData() not working for me
<p>I am trying to check if an object with class sourceFocus has data in it. However when I check it, it does not have data when it should. What am I doing wrong here?</p>

<pre><code>$('.source').click(function() {
    $('.source').removeClass('sourceFocus'); 
    $(this).addClass('sourceFocus'); 
    $(this).data('source_selected', true);
    console.log($.hasData(this));
    console.log(this);
});

$('.target').click(function() {

    $('.target').removeClass('targetFocus'); 
    $(this).addClass('targetFocus'); 

    $(this).data('target_used', true);
    //$('.sourceFocus').data('source_used', true);

    console.log($.hasData('.sourceFocus'));

    if($.hasData('.sourceFocus')){
        console.log("has data worked");
        check_for_duplicates();
}
</code></pre>
