I am tying to understand a project where used JQUERY to manipulate the DOM. I have the following element:
<a data-modal-trigger data-modal-target=".modal-confirm" class='confirm-modal-trigger' style='width: 1px;'></a>
In the javascript code I have this tag clicked by the code:
$(".confirm-modal-trigger").click();
But there is no call-back function definiton attached to this event like:
$(".confirm-modal-trigger").click(function(){....});
or $(".confirm-modal-trigger").on("click", function(){....});
I am searching trough the whole project files and nothing. Then what is the purpose of clicking this a
tag if there is no href
attribute nor there is a call back function defined when button is clicked?
And the most strange part is that when I comment this line
$(".confirm-modal-trigger").click();
The code doenst work as it should.
* EDIT *
I read the proposed original answer, and I still don't uderstand why when commented the .click()
the pop-up window that normally appears (when not commented) doesen't appear when I comment this line. If there is no action behind it - just a sematnic meaning, why I observe that behaviour?