[Solved] How to fire an event on hidden button inside div on click of div


The .get() method grants access to the DOM nodes underlying each jQuery object. If the value of index is out of bounds — less than the negative number of elements or equal to or greater than the number of elements — it returns undefined.

$('#newDiv').on('click', function(event) {
    $('#btnHidden').get(-1).click();
});

$("#btnHidden").on("click", function() {
  console.log("Hidden Button Clicked");
});
#newDiv {
  border: 1px solid red;
  padding: 10px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="newDiv">
  <button id="btnHidden" hidden>Submit</button>
</div>

0

solved How to fire an event on hidden button inside div on click of div