What you could do is to give your link only a class and href to # (what links to none) like:
<a class="close" href="#" >×</a>
And your JS could look like:
<script>
$(document).ready(function(){
//check if close element exists. If yes, execute the function
if($('.close').length() > 0) load_thankyou();
});
function load_thankyou()
{
alert('hii');
var delay = 1000; //Your delay in milliseconds
var URL = 'thankyou.php';
setTimeout(function()
{
window.location = URL;
}, delay);
}
</script>
this waits until page is load and check if the a-tag exists and if yes it will execute the function. kind of like a onload for a-tags
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…