SO - 21799470

by Arun P Johny

HTML

<img src="sample.jpg" alt="sample alt" />

JavaScript

jQuery(function () {
    $('img[src]').attr('data-src', function () {
        return $(this).attr('src')
    }).removeAttr('src');
})