I have a lightbox gallery.
<ul class="gallery"> <li><a href="http://newdomain.ru/images/30652.jpg" title="" rel="lightbox-atomium"> <img src="http://newdomain.ru/images/30652t.jpg"> </a> </li> </ul> It is necessary when a link to a large picture is lost, replace its address from the old domain. I am writing on jQuery - does not work. What am I doing wrong
<script> $('a').on('error',function(){ $(this).attr('href', $(this).attr('href').replace('newdomain', 'olddomain')); }); </script>