Skip to content

Instantly share code, notes, and snippets.

@Microsofttechies
Created October 7, 2014 20:51
Onclick change url using jquery
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Test</title>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script>
$(function () {
$("a").click(function () {
var objHref = $(this).attr("href");
if (objHref != "#") {
$(this).attr("href", objHref + "?ID=22");
}
});
});
</script>
</head>
<body>
<a href="##">Hello</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment