I am trying to create an event handler. I want to click the div tag and the a tag is also clicked, which should redirect to Google.com
This is my code:
<div id="testTrigger"> Test Div </div>
<a id ="TestButton" href="https://www.google.com/webhp?hl=en&sa=X&ved=0ahUKEwi5lY3N9Z3hAhUD9YMKHRjPCJcQPAgH" role="button">Test Button</a>
<script>
$( document ).ready(function() {
$( "#testTrigger" ).click(function() {
$("#TestButton").click();
});
});
</script>
I tried all the ways I can think of, but nothing works.
Any help is appreciated. Thank you