0

How to call click function on input tag when I press in to the input field or change the value in the field like.

jquery('input').click();

I can't figure it out how to do I have checked other places?

Community
  • 1
  • 1
Aman Singh
  • 80
  • 7

2 Answers2

1

use the

jquery('input').keypress(function (){'body'})

or

jquery('input').keydown(function(){  'body'; })

function it will trigger when you will press any key.

zolter
  • 7,070
  • 3
  • 37
  • 51
John Ambrose
  • 167
  • 1
  • 11
0

I would use 'document' .on as it is a bit more reliable then the .click() although producing the same end result.

jQuery(document).on('click','input', function(){
    // do something
});
  • 1
    Though your code might answer the question, you should at least add a short description of what your code does and *how* it actually solves the problem. – user1438038 Feb 16 '17 at 10:17
  • 1
    Fair point. I have updated it accordingly. Sometimes I just think code. Thank you for the advice. – Christopher Almond Feb 16 '17 at 11:45