0

I want to show a specific message only if the button click event is done by user manually. If it is clicked by script then message should now show. How can i do so in Jquery.

$('#save_btn').change(function(e){
if (e.originalEvent !== undefined)
{
successMsg();
}
});

1 Answers1

0

You can see where the button was clicked:

$('#save_btn').on("click", function(e) {
  console.log(e.pageX)
});

$('#save_btn').click()
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button type="button" id="save_btn">Click me</button>
mplungjan
  • 169,008
  • 28
  • 173
  • 236