jQuery exclude exteranl link for images

JavaScript
$('a:not([href^="http://your-website.com"]):not([href^="#"]):not([href^="/"])').addClass('external');
Source

Also in JavaScript: