Code HTML4Strict:
<a href="#" class="foo" data-email="test@test.com">test 1</a><br>
<a href="#" class="foo" data-email="me@email.com">test 2</a>
 
<script>
    $(document).ready(function(){
        $('.foo').click(function() {
        var email = $('.foo').attr('data-email');
        alert(email);
    });
});
</script>

I'm trying to pass the value of data-email to my script, and as you javascript guys know, this isn't working correctly. How can I do this?

Thanks!