Reputation: 327
I am trying to fire onclick event of multiple <a>
tags one after another using .each()
loop.
The first click is working fine but the others are not working.
The <a>
has same class with different Id and function parameters
<div id="outerDiv">
<div><a class="AnchorDiv" href="javascript:void(0);" onclick="ITHit.WebDAV.Client.DocManager.EditDocument('firstdocumentpath', 'listnerUrl', null); " style="display: none;" id="docId1"></a></div><div><a class="AnchorDiv" href="javascript:void(0);" onclick="ITHit.WebDAV.Client.DocManager.EditDocument('firstdocumentpath', 'listnerUrl', null); " style="display: none;" id="docId2"></a></div><div><a class="AnchorDiv" href="javascript:void(0);" onclick="ITHit.WebDAV.Client.DocManager.EditDocument('seconddocumentpath', 'listnerUrl', null); " style="display: none;" id="docId3"></a></div><div><a class="AnchorDiv" href="javascript:void(0);" onclick="ITHit.WebDAV.Client.DocManager.EditDocument('thirddocumentpath', 'listnerUrl', null); " style="display: none;" id="DocId4"></a></div><div>
The code I have tried which opens only first document
$("#outerDiv .AnchorDiv").each(function (e) {
$(this).click();
})
Upvotes: 1
Views: 82