Set source to current URL

Update the source with the current URL

by Laurie

HTML

<a href="http://iphly.phly.net/Lists/CEO%20Suggestion%20Box/NewForm.aspx" class="special-links" title="" target="_blank">Submit</a>


<h6>THE CURRENT HREF VALUE AFTER THE CHANGE:</h6>

<p class="hrefVal"></p>

<h6 class="dark">If you click the link, a new window will be oppened with a google search instead of the default google search page</h6>

CSS

.hrefVal {
    margin: 10px;
    border: 1px solid #D9D9D9;
    background-color: #F2F2F2;
    padding: 6px;
    font-size: .8em;
    font-family: sans-serif;
}
h6 {
    margin: 20px 10px 0 10px;
    font-size: 0.8em;
    font-family: sans-serif;
    color: green;
}
.dark {
    color:#000;
}

JavaScript

jQuery(document).ready(function () {
    var url = jQuery("a.special-links").attr("href");
    var source = jQuery(location).attr('href');

    jQuery("a.special-links").attr("href", url + "?source=" + source);

    // see the current href
    jQuery('.hrefVal').html(jQuery("a.special-links").attr("href"));
});