force click btn using jquery

Solutions on MaxInterview for force click btn using jquery by the best coders in the world

showing results for - "force click btn using jquery"
María Camila
16 Mar 2018
1example:
2
3<button id='testButton'>Test</button>
4
5<script>
6$(function(){
7   $('#testButton').on('click' , function(){
8        alert("I've been clicked!");
9   });
10
11   //now on another event, in this case window resize, you could trigger
12   //the behaviour of clicking the testButton?
13
14  $( window ).resize(function() {
15        $('#testButton').trigger( "click" );
16  });
17
18});
19
20</script>
21