I have multiple images on my page. To detect broken images , I used this found on SO.
$(\'.imgRot\').one(\'error\',function(){
$(this).attr(\'src\',\'bro
Community wiki: This generic answer does not contribute to the question OP posted but relative to the title.
The concept of one() and on() can be explained with the below code.
one()
function is automatically moved to off state after first instance of occurance.
on()
is identical to one() but it needs to be manually put to off state otherwise the number of instances has no limit.
var i = 1;
$('.one').one('click', function() {
$(this).text('I am clickable only once: ' + i);
i++;
});
var j = 1;
$('.multiple').on('click', function() {
$(this).text('I was clicked ' + j + ' times');
j++;
});
Click me
Click me