change the URL for a Hyperlink using jQuery

August 5, 2010 | Filed Under JQuery | Comments Off
There are three way to change   the URL for a Hyperlink using jQuery.

1-   $("a").attr("href", "http://www.phpinterviewquestion.com/");

2- $("a[href='http://www.phpinterviewquestion.com/']")
     .attr('href',   'http://phpinterviewquestion.com/');
3-  $("a[href^='http://phpinterviewquestion.com']").each(function(){
      this.href = this.href.replace(/^http:\/\/beta\.phpinterviewquestion\.com/,
 "http://phpinterviewquestion.com");
     });

Comments

Comments are closed.

© PHPInterviewQuestion.com 2009 - 2012

eXTReMe Tracker