Reputation: 9
i know how to track the click event on anchor tag when href attribute is directly assigned. but instead of assigning href attribute if we give the destination link in onclick function. or when we are loading ajax file how to track the destination url?
Upvotes: 0
Views: 1970
Reputation: 5343
Not quite sure what your looking for but I'll give it a try do you mean something like this? When they click on the element it will redirect them?
Post some clearer details and ill edit.
var MyURL = 'http://ABCDEF.com' //Define MyURL
$('#MyElementID').click(function () { //Define the element ID that you click
window.location = MyURL; //Tell it what to do e.g load MyURL
}
Then to figure out what the destination is
$('#MyElementID2').html(MyURL); //Display MyURL in Element
or Alert:
alert(MyURL); //Alert MyURL.
Upvotes: 1