In my code, I want to click on the div and have it fire a click()
on the specified element ID, however I'm getting this recursion error instead, like it's in an infinite loop.
function clickLink(id) {
$('#' + id).click();
}
.theDiv {
border: 1px solid red;
width: 200px;
height: 200px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
click the div, but not on the link
<div class="theDiv" onclick="clickLink('linkId')">
<a href="http://www.google.com" id="linkId">i am a link</a>
</div>