Some common techniques for jquery filters, such as filtering properties
/* Filter to get no nodes with Data-xsui-grid-colspan */
$ (this). Find ('. Xsui-grid-cell:not ([Data-xsui-grid-colspan]) ');
jquery bound input control's carriage return event
//Input text input box Press OK button, Trigger tab button, automatically jump to the next input box$ (' input[type= "text"] '). Bind (' KeyDown ',function(e) {if(E.keycode = = 13) { var$inputs = $ (' Input, select, textarea ');// varInputcount =$inputs. Length; varINPUTIDX = $inputs. Index ($ ( This)); if(Inputcount > 0 && inputidx <inputcount) {$inputs. eq (inputidx+ 1). focus (); } //e.keycode=9;//No Eggs }});//JavaScript Binding page Return key eventDocument.onkeydown =function(e) {varEV = document.all?window.event:e; if(Ev.keycode = = 13) {alert (' JavaScript bound page Enter key event '); document.forms[0].submit (); //$ (' form '). submit ();//Handle Event }}//jquery bound page Return key event$ ("body"). Bind (' KeyUp ',function(event) {if(Event.keycode = = 13) {alert (' jquery bind page Enter key event '); Document.form.submit (); }});//If the form contains a button containing [type=] "submit", as long as the page gets focus, it will automatically bind the carriage return event to the submit button without additional code binding//if the button that submits the form is not a regular submit button, but rather a hyperlink or a normal button control, you need to bind the Enter event to the control (or you can replace it with the Click event directly)$ (' a '). KeyDown (function(e) {if(E.keycode = = 13) {alert (After the ' a ' tag gets focus, press ENTER to submit the form ') $(' form '). Submit ();//Handling Events }});$(' A '). Click (function() {alert (After the ' a ' tag gets focus, press ENTER to submit the form ') $(' form '). Submit ();//Handling Events});
Download: [Jquery_keyboard_event_demo.zip]
Copyright NOTICE: This document is licensed under the attribution-Non-commercial use-sharing (CC BY-NC-SA 3.0 CN) International License Agreement, please specify the author and source. Article title: Code Collection series--jquery--Filter Tips This article link: http://www.cnblogs.com/sochishun/p/7061576.html This article Sochishun (e-mail: 14507247#qq.com | blog: http://www.cnblogs.com/sochishun/) Published: June 23, 2017 |
Code Collection Series--jquery--filter, event binding tips