Reputation: 343
I'm trying to get all of the images on a page to open in a new window. However, for some reason, jQuery's "tabs" method is preventing the code from working. The tabs method is called in an external js file that is pulled in for this page, and is needed. The tabs method is not called on this page either. The code that I used for a test page is below. Is there something that I can do to make the link code work without removing tabs?
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script>
$().ready(function(){
$(".tabs").tabs();
$("a").click(function(event){
alert("ALERT");
var temp=$(this).attr("href").split(".");
if (temp[temp.length-1]=="jpg"||temp[temp.length-1]=="jpeg"){
window.open("http://www.google.com");
}
});
});
</script>
</head>
<body>
<a href="http://www.google.com.au/logos/2013/cecilia_may_gibbs_136th_birthday-1016005-hp.jpg">This should go to google</a><br />
<a href="http://library.uis.edu">This should not go to google</a>
</body>
</html>
Upvotes: 0
Views: 84
Reputation: 114347
.tabs()
are part of jQueryUI, which you have not included in your page, therefore it fails.
Upvotes: 2