I want instead of pressing the link of the anchor tag
to load the page in href
attributre I want the anchor
invisible for the user, and clickable via the button provided.
This is the code:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$("a").click();
});
});
</script>
</head>
<body>
<body>
<a href="http://www.touchwand.com/wp-content/uploads/2018/04/Icons-and-backgrounds.zip"></a>
<button >Button1</button>
</body>
If I click directly on the anchor I get to the URL, but via button it doesnt work. Why is not <a>
clicked by the click()
function? Why is it not working?