Klaus Hartl wrote:
$(function() {
    $('li.deal').each(function() {
        var $a = $('h2 a', this);
        $(this).bind('click', function(e) {
            if (e.target != $a[0]) {
                location.href = $a.attr('href');
            }
        });
    });
});


shorter, shorter...:

$(function() {
    $('li.deal').each(function() {
        var a = $('h2 a', this)[0];
        $(this).bind('click', function(e) {
            if (e.target != a) {
                location.href = a.href;
            }
        });
    });
});

(in this case we don't really need any normalization via attr('href'))


--Klaus

Reply via email to