focus

jquery中:input和input的区别

*爱你&永不变心* 提交于 2019-12-25 00:53:56
:input表示选择表单中的 input,select,textarea,button 元素,input仅仅选择input元素。 <script type="text/javascript"> $(function(){ $(" :input ").focus(function(){ $(this).addClass("focus"); }).blur(function(){ $(this).removeClass("focus"); }); })// 这个效果第三个textarea也会添加样式 </script> <form action="" method="post" id="regForm"> <fieldset> <legend>个人基本信息</legend> <div> <label for="username">名称:</label> <input id="username" type="text" /> </div> <div> <label for="pass">密码:</label> <input id="pass" type="password" /> </div> <div> <label for="msg">详细信息:</label> <textarea id="msg" rows="2" cols="20"></textarea> </div> <

Emacs sloppy focus no longer working - 2 second delay on changing focus

感情迁移 提交于 2019-12-24 22:25:37
问题 I have the following set in my init.el (setq focus-follows-mouse 1) (setq mouse-autoselect-window 1) This is intended, and was previously working, to cause emacs to automatically switch focus to the window where my mouse was hovered over, instantly. However, there is now a ~2 second delay in switching. Any ideas what might be causing this, with no other notable changes? 回答1: From the documentation for mouse-autoselect-window : A positive number means delay autoselection by that many seconds:

qt app that takes in textedit barcode scanned, how to change focus between two fields

一笑奈何 提交于 2019-12-24 20:13:10
问题 So for me the plan is like this: I scan a barcode, it gets in first textedit; I scan another barcode, it gets in the second textedit, in this case i use focus and keyboard event. my problem is when i scan first code it is fine but when I scan the second code, some of letters go to second texedit some go to first texedit. I don't understand what is the problem here is my code void CWidget::keyPressEvent(QKeyEvent *event) { if(focusWidget() == ui->lePath && !ui->lePath->text().isEmpty()) { ui-

Tracking focus on cross-origin iframe

浪子不回头ぞ 提交于 2019-12-24 19:34:01
问题 I have a web app with an embedded video within an iframe, typically from a cross-origin source (e.g. YouTube). I currently track focus on window for logging purposes. However, since iframes are not children of window , when the user clicks into the iframe, window blurs, stopping my logs though the user is still viewing the page. How can I track focus to this cross-origin iframe? 回答1: tl;dr - you can't track focus on the iframe, at least not directly. But there are other sources of information

How to detect when any child view recieves a click

回眸只為那壹抹淺笑 提交于 2019-12-24 18:17:32
问题 Given an arbitrary ViewGroup G with an arbitrary collection of child views, how can I detect when the user clicks on any of the child views? In this case, I want to draw a highlight for G. I could add an onClick listener for each child, but I'm trying to avoid that so that the code doesn't have to be changed when the layouts change. Alternatively, I could add onTouch handlers to G and set the highlight during ACTION_DOWN. However, this would trigger for actions that don't actually result in

How to set focus on rich-text-field, in edit-mode of a contenttype?

那年仲夏 提交于 2019-12-24 16:57:55
问题 I'd like to initially set the focus onto the text-field of an item when editing it, but cannot overcome TinymMCE'S iframe kickin' in. When disableling TinyMCE, everything works as expected, the text-field is focusable. I tried simulating a click in TinyMCE's body-element, no luck either. Is it possible at all, to focus the body-field via JS? This is what I tried so far: (function($) { $(document).ready(function() { $('#text').focus() // Only works, when TinyMCE is disabled. $('body#content')

Back key navigation doesn't work even though focus is set to true

吃可爱长大的小学妹 提交于 2019-12-24 16:15:49
问题 In my Qt Android app I push an Item from the menu to the StackView: import QtQuick 2.0 import QtQuick.Controls 1.0 ApplicationWindow { menuBar: MenuBar { Menu { title: qsTr("Menu") MenuItem { text: qsTr("Push page") onTriggered: stackView.push("qrc:/qml/SecondPage.qml") } } } StackView { id: stackView anchors.fill: parent // Implements back key navigation focus: true initialItem: FirstPage { width: parent.width height: parent.height } } } SecondPage.qml: import QtQuick 2.0 import QtQuick

Focus on TextBox after ListView 'SelectionChanged' Event

 ̄綄美尐妖づ 提交于 2019-12-24 14:12:42
问题 I wish to set focus on a TextBox after an item is selected from a ListView control, but I can't seem to get it to focus from within my 'SelectionChanged' event method FocusOnTextBox() . For some reason the ListView always has focus after a selection is made. I have created a Visual Studio application to demonstrate this problem: http://maq.co/focusapp.zip How can I get the focus to return to the TextBox from within my 'SelectionChanged' event method? MainWindow.xaml: <Window x:Class=

Prevent system tray icon from stealing focus when clicked

﹥>﹥吖頭↗ 提交于 2019-12-24 12:12:37
问题 I am writing an application in Java that places an icon in the system tray (via SWT). When this icon is clicked, I wish to have it automatically type some keys (via the Robot class) into whatever text field is in focus at the time of clicking (could be in any window). Unfortunately, clicking the system tray icon steals the focus away from the previously focused window, thereby stealing the key strokes. Is there a way to cause the text to be typed into the previously focused window? 回答1:

JQuery: .focus() event on whole form? How to?

徘徊边缘 提交于 2019-12-24 12:03:38
问题 consider the following HTML: <form ....> <textarea>....</textarea <input .... /> </form> Now I want to show a help section when the user is focused on ANY of the form elements. When the focus is gone the help information should too. My idea was this: $("form").focus(function(){...}); $("form").unfocus(function(){...}); But it doesn't seem to work. Any ideas? Thanks a lot for your help! Tom Addition: Thank you all a lot, it works. I used lonesomeday's solution, but there is another problem