I have a click function which runs code similar to the following:
$('#go').click(function(e){
var url = $("#url").val();
$this = $("#convert");
$this.css({"text-align":"center","font-size":"18px"});
$this.html("<a href='http://www.site.com/out/?u=" + url + "'>You will be redirected in <span id='counter'></span> seconds!</a>")
var count = 10;
var counter = document.getElementById('counter');
setInterval(function(){
count--;
counter.innerHTML = count;
if (count === 0) {
window.location = 'http://www.site.com/out/?u=' + url;
}
}, 1000);
});
but I also want this to be triggered on page load.. for example, if the visitor goes to a url like:
It’ll run the click function on the URL after the hash sort of thing..
How would I go about doing this?
jquery on load fire click event: