# Other Languages > jQuery >  JQuery > button > click created link

## Ecniv

Hi again,

I have this working in Chrome and Firefox (although Firefox blocked direct clicking on a created link - click a span in a link tho...)
However, Edge/IE(?) runs the JS up to the JQuery trigger... and doesnt run the last bit.



```
function dlResultos( mimeType ){
	var al=$("#hiddenlink");
	var dt = new Date();
	var filename = ''+dt.getYear()+(dt.getMonth()+1)+dt.getDate()+dt.getHours()+dt.getMinutes()+dt.getSeconds()+"sql.txt";
    var elHtml = "";
	var obj = document.getElementById("resultoHidden"); 
	
	if( obj != null ) {	
		elHtml = obj.innerHTML;
		elHtml = elHtml.split("<br>").join("\r\n");
		elHtml = elHtml.split("&nbsp;").join(" ");
	}
	
	if( elHtml.length>0 ) {
		if(al.length==0){
			al = $("<a></a>");
			al.attr("id","hiddenlink");
			al.css("display","none");
			$("#btnDLR").after(al);
			al.html($("<span></span>").text("test"));
		}
		
		al.attr('download',filename);
		al.attr('href','data:' + mimeType  +  ';charset=utf-8,' + encodeURIComponent(elHtml));
		$("#hiddenlink span").trigger('click'); // < problem is here on edge

	}else{
		alert("Nada para salvar!");
	}

}
```

Does Edge have a security measure to block this type of clicking ?


Note: running a Java JSP page... for the extra code not JS...

----------


## Prahlad

Hello,@Ecniv

Please try this code,To JQuery > button > click created link



```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Trigger Click on a Link</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
function doSomething(){
    alert("Click event is triggered on the link.");
}
$(document).ready(function(){
    $("button").click(function(){
        $("a")[0].click();
    });
});
</script>
</head> 
<body>
    <p><a href="#skyImage" onclick="doSomething()">Bookmark link to an image</a></p>
    <button type="button">Trigger Click</button>
    <div style="margin-top: 800px;">
        <img src="/examples/images/sky.jpg" id="skyImage" alt="Cloudy Sky">
    </div>
</body>
</html>
```

I hope this code will be useful for you.
Thank you

----------


## jmcilhinney

> Hello,@Ecniv
> 
> Please try this code


If the OP is still waiting for a solution to this issue after nearly four years, I'd be gravely concerned. That's not to say that you should not provide advice, because it may help others who find this thread via a search. I'm not sure that the OP will be trying it though.

----------

