I have some jQuery code that works quite well for opening external links in new windows, although I am running into compatibility issues with my Joomla site and jQuery. I've run into this issue in the past, and the easiest method to resolve it is to use the Joomla system Mootools library.
Here's the jQuery script I need converted into Mootools:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('a[href^="http://"]').filter(function() {return this.hostname && this.hostname !== location.hostname;}).attr('target', '_blank');
});
</script>
Could someone please help me convert the above code?
Once again, Mootools is already enabled via a system plugin.
noconflictin the jquery api. The best way to declare thedocument.readyevent in jQuery is like this:jQuery(function($){...your code here...});as it will alias jQuery to$within the context of the function. - zzzzBov