Q
Q
qwerty17772018-02-22 10:27:32
css
qwerty1777, 2018-02-22 10:27:32

How to simulate a click with jQuery?

Click simulation does not work. It is necessary that by clicking on the first block, an imitation of a click on the second block occurs
Code https://jsfiddle.net/pxhjLsgq/9/

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Shamsudin Serderov, 2018-02-22
@Steein

$('#id').click(function(){
    return false;
})

You can send events to jQuery using the trigger method.
$('#id').trigger('click');

N
Nikita, 2018-02-22
@Rema1ns

$(document).ready(function() {
  $('.block_one').click(function() {
  	$('.block_two').trigger('click');
  })
  
  $('.block_two').click(function(){
     alert();
  })
  
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question