javascript - Simulate real click programatically -


i using code identify if click programatically triggered.

how should edit $('#x').trigger('click') simulate real click? (hasownproperty should return true 'real')

$('#x').click(function(e) {     if(e.hasownproperty('originalevent')) {         $('#out').append('<li>real</li>');     } else {         $('#out').append('<li>unreal</li>');     } }); $('#y').click(function() {     $('#x').trigger('click'); //how edit }); 

so want not possible. real click - elevated permissions (like window.open no being blocked popup blockers) cannot simulated.

if insist though... particular case might solved dispatching click event programmatically element. in many ways can error prone.

var event = new event('click');  $('#x')[0].dispatchevent(event); 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -