1. Find all internal links
1: $("a[href^='/'],a[href*='"+location.hostname+"']")
2. Find all external links
1: $("a[href*='http://']:not([href*='"+location.hostname+"'])")
--> Using to change style automatic
1: $(document).ready(function() {
2: $("a[href*='http://']:not([href*='" + location.hostname + "']),[href*='https://']:not([href*='" + location.hostname + "'])").attr("target", "_blank").attr("title", "Opens new window").addClass("external");
3:
4: });
Categories:
jQuery
0 comments:
Post a Comment