diff --git a/jquery.djax.js b/jquery.djax.js index 6529c15..43962b4 100644 --- a/jquery.djax.js +++ b/jquery.djax.js @@ -218,9 +218,16 @@ // Only add a class to internal links $(this).find('a').filter(function () { - return this.hostname === location.hostname; - }).addClass('dJAX_internal').on('click', function (event) { - return self.attachClick(this, event); + return this.hostname === location.hostname; + }).addClass('dJAX_internal'); + + + // attachClick to links with '.dJAX_internal'. Includes links loaded via ajax. + $(this).on('click', '.dJAX_internal', function (event) { + if (this.hostname !== location.hostname) + return; + event.preventDefault(); + return self.attachClick(this, event); }); // On new page load