In JQuery, how to make an action when choosing an input with a mouse click? -


as can see below, there history addresses chan choose in formular, when choose 1 , press "enter" color adapt (become green if it's mail address, or stay red if not). did using piece of code (jquery):

  $( "#mail" ).keyup(function() {      if(!validateemail($("#mail").val())) {         $("div.mail").removeclass("has-success");         $("div.mail").addclass("has-error");     }     else{       $("div.mail").removeclass("has-error");       $("div.mail").addclass("has-success");       }      }); 

enter image description here

but problem if click "history" email address mouse instead of pressing "enter", nothing happens (even if choose mail address). tried other jquery functions .mouseup() or .click() still not work.

do have idea ?

try this:

$('#selector').focus(function(){     // code here }); 

focus event fires when element focus either mouse selection or tab.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -