Created
October 21, 2013 16:44
-
-
Save arvindang/7086948 to your computer and use it in GitHub Desktop.
Use jQuery to change link copy and URL on hover.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-git2.js"></script> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<a href="http://google.com">Google</a> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a').hover(function () { | |
var onText = $(this).text(); | |
onText = "Yahoo"; | |
$('a').text(onText); | |
var atag = $('a'); | |
atag.attr("href", "http://yahoo.com"); | |
}, | |
function () { | |
var offText = $(this).text(); | |
offText = "Google"; | |
$('a').text(offText); | |
var atag = $('a'); | |
atag.attr("href", "http://google.com"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment