JQueryでimgのonerrorをハンドリングする方法「こんなの出た⇒$(…).error is not a function」

これはできなかった
$('img').error(function() {
    $(this).attr('src','');
    alert('error');
});
$(...).error is not a function

結果

$('img').on('error', function() {
    $(this).attr('src','');
    alert('error');
});

だいたい、onにすればこういうのは解決

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です