Posted By

lynseydesign on 11/18/10


Tagged


Versions (?)

Add to href attribute of existing link


 / Published in: jQuery
 

Redirect Links to Internal Page with Orignal Link as #hash

  1. jQuery("div#listings-widget a").each(function() {
  2. var path = jQuery(this).attr('href');
  3. var newpath = "http://localhost/WandP/listings/#" + path;
  4. jQuery(this).attr('href', newpath);
  5. });
  6.  
  7.  
  8. //Find #hash in current url and load in iframe
  9. var url = window.location;
  10. var anchor = url.hash;
  11. var newanchor = url.hash.substring(1);
  12.  
  13. jQuery(document).ready(function() {
  14. jQuery("iframe").attr("src", newanchor);
  15. });

Report this snippet  

You need to login to post a comment.