onkeyup

Instant search function in Javascript

匆匆过客 提交于 2019-12-01 11:19:10
I am using the following javascript for my instant search function (to detect when the visitor stops writing, so the function won't run on every single keyup). It works but it’s more delay than 1000 milliseconds. Even if I set it to 200 milliseconds it’s 1-2 seconds delay before the instant search function runs. Is there a better/faster way to detect when the visitor has stopped typing in the input (I only need it for Internet Explorer if that’s make any difference). $(document).ready(function(){ var delay = (function(){ var timer = 0; return function(callback, ms){ clearTimeout (timer); timer

Instant search function in Javascript

柔情痞子 提交于 2019-12-01 08:16:07
问题 I am using the following javascript for my instant search function (to detect when the visitor stops writing, so the function won't run on every single keyup). It works but it’s more delay than 1000 milliseconds. Even if I set it to 200 milliseconds it’s 1-2 seconds delay before the instant search function runs. Is there a better/faster way to detect when the visitor has stopped typing in the input (I only need it for Internet Explorer if that’s make any difference). $(document).ready

keyup not working on Chrome on Android

情到浓时终转凉″ 提交于 2019-12-01 03:42:19
问题 I am using bootstrap typeahead. It depends on this jQuery code to work: el.on('keyup', doSomething() ) On Chrome on Windows it works fine. On Chrome on Android it doesn't. The keyup event is never fired. The element to which it is bound definitely has the focus. This appears to be a recent development. Chrome 28.0.1500.64 Android 4.1.2 SGP321 Build/10.1.1.A.1.307 Thanks --Justin Wyllie 回答1: I came across this same problem earlier today. How can android chrome not support these key events! I

javascript - capture input and convert characters

老子叫甜甜 提交于 2019-12-01 00:49:06
I want to capture input charcters in text box, convert then according to a table and put them back in text box as user types. <form id='myForm'> Enter phone number:<input type="text" id='idMyText' name="myText" onKeyUp="alphaToNum(this.value)"> </form> <script> // on each keypress in input box, I want to capture key pressed, // determine if key pressed belong to group of identified characters // if, so then convert to specified numeric equivalent and return character // to text box. // This mapping corresponds to numeric characters on blackberry device. // Normally user has to press alt+letter

iOS 9 - keyup event not firing

自古美人都是妖i 提交于 2019-11-30 14:02:05
问题 Is anybody else having problems with the keyup event in iOS 9 not firing? Just a simple test bed replicates the issue for me. <input id="txtInput" /> Vanilla JS: document.getElementById('txtInput').onkeyup = function () { console.log('keyup triggered'); } jQuery: $('#txtInput').on('keyup', function () { console.log('keyup triggered'); }); Neither fire... 回答1: I suggest using the keypress event on browsers with touch screens. I know that you can't really detect touch screen screens, though, so

jquery bind keyup to body in firefox

廉价感情. 提交于 2019-11-30 08:28:12
问题 i m binding keyup function in jquery to body which works in every browser except firefox the code: - $('body').bind('keyup', function(e) { //alert ( e.which ); alert('testing'); }); how do i do it for firefox. it does not responds at all thanks 回答1: bind the event to the document instead: $(document).bind('keyup', function(e) { alert('testing'); }); You can make almost any node receive keyboard events. In "modern" browsers, you can setup a tabIndex . After that the event is focusable. $

onkeyup event in Safari on IOS7 from a bluetooth keyboard

心已入冬 提交于 2019-11-29 14:16:12
I have the following setup: Bluetooth scanner iPad Webpage with a textfield for scan input Usage: User focus textfield and scan barcode with bluetooth scanner Scanner adds ENTER (13) at the end of the scan Problem: On Safari in IOS7 there seems to be a change on how keyboard events are handled on bluetooth devices. The code ... window.onkeyup = function (e) { console.log(e.KeyboardEvent) } ... should return information about the key pressed. Instead i get ... keyCode: 0 keyIdentifier: "Unidentified" ... no matter which key I press. Same result booth form bluetooth scanner and bluetooth

Upgraded to AppCompat v22.1.0 and now onKeyDown and onKeyUp are not triggered when menu key is pressed

一笑奈何 提交于 2019-11-27 20:39:33
I've just upgraded my app to use the newly released v22.1.0 AppCompat and now onKeyDown and onKeyUp are not triggered when menu key is pressed. The other keys correctly trigger onKeyDown and onKeyUp , but when i press the menu key nothing happens. If I downgrade to v22.0.0 everything returns to work properly. How do I fix it? Update 23 August This has been fixed again in the v23.0.0 of appcompat-v7 support library. Update to the last version to see this fixed. Update 19 July Unfortunately AppCompat v22.2.1 broke the onKeyDown and onKeyUp events again . I just updated

Change color of specific words in textarea

本小妞迷上赌 提交于 2019-11-27 11:43:57
I'm building a Sql query builder and would like to change the text color of a word in a textarea when the user types in words like SELECT, FROM, WHERE. I've searched around a bit and beyond this ( https://jsfiddle.net/qcykvr8j/2/ ) I unfortunately do not come any further. Example code HTML: <textarea name="query_field_one" id="query_field_one" onkeyup="checkName(this)"></textarea> JS: function checkName(el) { if (el.value == "SELECT" || el.value == "FROM" || el.value == "WHERE" || el.value == "LIKE" || el.value == "BETWEEN" || el.value == "NOT LIKE" || el.value == "FALSE" || el.value == "NULL"

jQuery key code for command key

白昼怎懂夜的黑 提交于 2019-11-27 03:33:25
I have read jQuery Event Keypress: Which key was pressed? and How can i check if key is pressed during click event with jquery? However my question is if you can get the same key event for all browsers? Currently I know that Firefox gives the command button (Mac) the code 224 while Chrome and Safari give it the value 91. Is the best approach to simply check what browser the user is using and base the key pressed on that or is there a way so that I can get 1 key code across all browsers? Note I am getting the value with the: var code = (evt.keyCode ? evt.keyCode : evt.which); I would love to