CHANGE THE URL FOR A HYPERLINK USING JQUERY

AVADHESH PATEL

Total Post:257

Points:1285
Posted by  AVADHESH PATEL
JQuery 
 2035  View(s)
Ratings:
Rate this:
  1. AVADHESH PATEL

    Post:257

    Points:1285
    change the URL for a Hyperlink using jQuery

    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");
                 });

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!