When the public platform is developed, the customer requests the input box to enter the content, the input box shows the Clear button, clear the contents of the input box ", use the" KeyUp "event when the Chinese input method part of the button KeyUp event is invalid, the following is the solution.
The binding "input" and "PropertyChange" events can be resolved with the following code:
varBind_name= "Input";//define the name of the event you want to bindif(Navigator.userAgent.indexOf ("MSIE")!=-1) bind_name= "PropertyChange";//determine if the event name for IE kernel ie kernel is changed to PropertyChange /*input box keyboard left event binding*/ $("Input"). Bind (Bind_name,function(){ if( This. value!=NULL&& This. value!= ""){ varinputwidth=$ ( This). Outerwidth (); varinputheight=$ ( This). Outerheight (); varInputoffset = $ ( This). offset (); varinputtop=Inputoffset.top; varinputleft=Inputoffset.left; $("#clearDiv"). CSS ({top:inputtop+2,left:inputleft+inputwidth-27}). Show (); Inputobj= This }Else{ $("#clearDiv"). Hide (); } });
In addition, there is another online solution, the specific idea for the input box to register the focus event, interval time to retrieve, I personally or more inclined to the above method, the following is the second program code:
<script language= "javascript" type= "Text/javascript" src= "Jquery.js" ></script> <script> $(function () { $(' #wd '). Bind (' Focus ', Filter_time); }) varstr = "; varnow = "Filter_time=function(){ varTime = SetInterval (filter_staff_from_exist, 100); $( This). Bind (' Blur ',function() {clearinterval (time); }); }; Filter_staff_from_exist=function() { now= $.trim ($ (' #wd ')). Val ()); if(Now! = "&& now!! =str) {Console.log (now); } STR=Now ; } </script>
Mobile, mobile website Chinese Input Method KeyUp event part of the button is invalid