onkeyup

Cmd Enter keyup combination detection using javascript

做~自己de王妃 提交于 2019-12-04 19:14:29
I'm using a keyup detection into all my forms to detect the enter button. This is easy, when you are focused in a form's input if you hit enter and the event keyCode is equal to 13 then the form submitted. But now I want to detect the Cmd + Enter combination, because when you are focused in a textarea, the enter button is a line break. So how my detect statement should look like? Thank you You mean ctrl with Cmd ? Then check if event.ctrlKey is true: if (event.ctrlKey && event.keyCode == 13) { alert('now'); } Also see this example . P.s: there are also the booleans event.altKey for alt , event

Trying to add delay to jQuery AJAX request

橙三吉。 提交于 2019-12-03 13:13:29
问题 I am trying to delay an AJAX request so that it is sent out 2-3 seconds after the LAST keyup of an input cell. So far I have managed to delay the requests, but after 2-3 seconds I get one request sent for every keyup in the field... How can I make jQuery cancel the first ones and just send the last keyup? Here's the code so far: $('#lastname').focus(function(){ $('.terms :input').val(""); //clears other search fields }).keyup(function(){ caps(this); //another function that capitalizes the

jQuery Cleditor get textarea value on keyup

爷,独闯天下 提交于 2019-12-03 06:18:14
I'm using Cleditor http://premiumsoftware.net/cleditor/docs/GettingStarted.html . I want to get the value on keyup and insert the text into another div. cleditor comes with change() event that i'm currently using in the jsfiddle example below, but thats not the same as keyup. I want the div to be updated as i'm typing in. I tried keyup but it doesn't work. Here's what i have now $("#input").cleditor().change(function(){ var v = $('#input').val(); $('#x').html(v); }) Check jsfiddle http://jsfiddle.net/qm4G6/11/ dgilland It appears that cleditor hides the textarea and replaces it with an iframe

Trying to add delay to jQuery AJAX request

陌路散爱 提交于 2019-12-03 04:05:36
I am trying to delay an AJAX request so that it is sent out 2-3 seconds after the LAST keyup of an input cell. So far I have managed to delay the requests, but after 2-3 seconds I get one request sent for every keyup in the field... How can I make jQuery cancel the first ones and just send the last keyup? Here's the code so far: $('#lastname').focus(function(){ $('.terms :input').val(""); //clears other search fields }).keyup(function(){ caps(this); //another function that capitalizes the field $type = $(this).attr("id"); // just passing the type of desired search to the php file setTimeout

js实时监听input输入框值的变化以便即使匹配搜索项

删除回忆录丶 提交于 2019-12-03 02:30:25
问题说明 在含有搜索框的网页中,经常需要及时匹配搜索项,因此需要监听input输入框的变化事件。如果使用 onkeydown、onkeypress、onkeyup 这个几个键盘事件来监测的话,除了监听不了右键的复制、剪贴和粘贴这些操作以外,在输入中文的拼音时同样触发,增加请求数不说还浪费流量。 解决方案 本文结合标准的oninput 和 IE 专属事件 onpropertychange 事件来监听输入框值变化。oninput 是 HTML5 的标准事件,对于检测 textarea, input:text, input:password 和 input:search 这几个元素通过用户界面发生的内容变化非常有用,在内容修改后立即被触发,不像 onchange 事件需要失去焦点才触发。 代码实现 $().ready(function(){ //页面加载完毕绑定输入框的oninput事件 var bind_name='input'; if(navigator.userAgent.indexOf("MSIE")!=-1) { bind_name='propertychange'; } $('input').on(bind_name, function() { do something... }); }); 参考链接: http://www.runoob.com/jsref/event

What are the options for (keyup) in Angular2?

喜夏-厌秋 提交于 2019-12-02 17:49:06
The following works great when the enter key is released. What other options are available for the keyup in addition to keyup.enter ? <input #inputstring (keyup.enter)="doSomething(inputstring.value)"/> These are the options currently documented in the tests: ctrl, shift, enter and escape. These are some valid examples of key bindings: keydown.control.shift.enter keydown.control.esc You can track this here while no official docs exist, but they should be out soon. I was searching for a way to bind to multiple key events - specifically, Shift+Enter - but couldn't find any good resources online.

How do I enter text in textfield with onkeyup/onfocus javascript?

萝らか妹 提交于 2019-12-02 13:53:43
问题 We have a web application that I am trying to automate testing for, using Java, Web Driver and TestNG. The biggest challenge I'm facing (failing at) is to stay ahead of development and prevent the test framework from breaking with even minor code changes. Problem There's a text field that accepts numbers. Up till now, sendKeys did the job for me. In a recent change to the page source, when numbers are entered, commas get automatically inserted. So "50000" becomes "50,000" for example. Now

onkeyup event asp.net

一个人想着一个人 提交于 2019-12-01 22:51:53
Hi how can i register and call a server side event for onkeyup event in asp.net textbox. Is it possible? thank you TextBox Web control doesn't provide onkeyXXX events instead subscribe to OnTextChanged event; <asp:TextBox ID='Textbox1' runat='server' OnTextChanged='HandleTextbox1OnTextChanged'> </asp:TextBox> public void HandleTextbox1OnTextChanged(Object sender, EventArgs e) { } But you can provide onkeyXXX behavior from client-side. You can add client-side handler like : Textbox1.Attributes.Add("onkeyup", String.Format("onKeyUp({0})", TextBox1.ID)); And in the page `<script language=

adding <br/> to the text-box when user press enter key in jquery

点点圈 提交于 2019-12-01 17:25:27
I want to add the <br/> (newline) to text box when user clicks on the enter button. How can I achieve it in jquery onkeyup event. Can one show me the example or any good website implementing it. Thank you Santosh Linkha Copied from here Caret position in textarea, in characters from the start See DEMO . <script src="jquery.js"></script> <script> $(function () { $('#txt').keyup(function (e){ if(e.keyCode == 13){ var curr = getCaret(this); var val = $(this).val(); var end = val.length; $(this).val( val.substr(0, curr) + '<br>' + val.substr(curr, end)); } }) }); function getCaret(el) { if (el

Keyup not firing when keydown opens an alert

ε祈祈猫儿з 提交于 2019-12-01 17:23:20
问题 I have two event handlers, one for keydown and one for keyup. The keydown event handler triggers an alert message, but this prevents the keyup event from firing. You can see a very simple example here: http://jsfiddle.net/boblauer/jaGwT/ When the keydown opens an alert, the keyup is not fired, but when an alert is not opened, the keyup is fired. Here's the code from the jsfiddle: var i = 0; window.addEventListener('keydown', function(e) { if (i++ % 2) alert('down'); console.log('down'); });