onfocus

Android On Focus Listener and On Click Listener on ImageView

a 夏天 提交于 2019-12-06 12:32:53
I have an imageview - It has both the attributes - focusable and focusableintouchmode set to true <ImageView android:id="@+id/ivMenu01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:focusable="true" android:focusableInTouchMode="true" > </ImageView> I have implemented the onFocusChangeListener in my activity- @Override public void onFocusChange(View v, boolean hasFocus) { switch (v.getId()) { case R.id.ivMenu01: if (hasFocus) { ivMenu01.setImageBitmap(Utility .getBitmap("Home_ford_focus.png")); // Focussed image } else { ivMenu01

How to make jQuery autocomplete list display all options onfocus and hide after option is selected?

那年仲夏 提交于 2019-12-06 06:11:24
问题 I have a form with an autocomplete that starts the search "onfocus" and shows the option list when the user clicks into the search field, even when they do not enter anything. The problem is the autocomplete requires the option to be selected with either the keyboard (down arrow followed by tab/return or with a double click). My first thought was that a single click causes the focus to remain in the search field, and thus the autocomplete to stay visible. However, the search field remains

Infinite loop of jQuery focus() event with a <select> element

守給你的承諾、 提交于 2019-12-05 18:37:22
I have this HTML: <select id="select-one"> <option value="">Choose</option> <option value="1">House</option> </select> <select id="select-two"> <option value="">Choose</option> <option value="A">Table</option> </select> And this Javascript with JQuery $("#select-two").focus( function() { if( $("#select-one").val() == "" ) { alert("Fill select-one first!"); return false; } }); So i am getting a infinite loop with alerts because after call alert() Javascript puts the focus again in the same select (select-two). Someone can help me to solve this please? Note : based on your comments, this assumes

How can restrict the tab key press only within the modal popup when its open?

放肆的年华 提交于 2019-12-05 09:54:53
I have a modal popup opened. I have accessibility requirement. So added ARIA related labels. But when i click tab key continuously focus going to the page behind the actual page. Added role="dialog" in html file But when modal opened i want only the focus navigate within the modal popup. Working on Angular4, HTML5 project. Better if we find a solution within HTML file itself . I mean without added any javascript/jQuery related stuffs to prevent this You are asking about focus trap , it's nicely demonstrated in this demo: http://davidtheclark.github.io/focus-trap/demo/ Adding role="dialog" will

jQuery - window focus, blur events not triggering - works in Firefox and Chrome

早过忘川 提交于 2019-12-04 09:49:32
In a nutshell; I wrote a simplistic chat application for a buddy and me to use. When the window running the application does not have the focus (minimized or behind other windows) and a message comes in, I want to change the windows title bar to serve as an alert. Exactly like Google's chat application does in GMail. Everything works flawlessly in Firefox and Chrome but not in IE7 (haven't tested 8). This is the code I am using to determine if the window has focus. Can this be written differently to also work in IE? Also, I'm open to any other approaches to accomplish the same thing. Many

I want to put cursor in beginning of text-box onfocus [duplicate]

五迷三道 提交于 2019-12-04 05:12:16
Possible Duplicate: Set cursor at a length of 14 onfocus of a textbox I am able to do that in firefox and IE. But for some reason its not working in Chrome and Safari :( I am simply using below line onfocus $('input:text').focus( function(){ document.getElementById('id').setSelectionRange(0, 0); }); Can someone please tell me how to do similar thing in Chrome and safari? Tim Down The problem is that Chrome (I haven't heard of Safari doing this as well, but I'll take you word for it) kills the selection after the focus event has fired, so you need to add a timer. The following is adapted from

window.onfocus not firing in IE7, inconsistent in Opera

旧城冷巷雨未停 提交于 2019-12-04 03:28:16
问题 Note that this relates to focus and blur events on a window, not on form fields. I'm loading a document in a pop-up window, and it includes the following code: <script type="text/javascript"> window.onblur = function(){ document.title="BLURRED"; } window.onfocus= function(){ document.title="FOCUSED"; } </script> These functions are temporary, for testing. I'd hoped to use these events to set a flag indicating the window state; I'm doing a chat app, and if messages come in when it's minimized

HTML input onfocus & onblur?

做~自己de王妃 提交于 2019-12-03 12:28:07
问题 ok, today I'm making a helper HTML function. It looks like this: function Input($name,$type,$lable,$value= null){ if (isset($value)) { //if (this.value=='search') this.value = '' echo '<label for="'. $name .'">'. $lable .'</label><input type="'.$type.'" name="'. $name .'" id="'. $name .'" value="'.$value.'" onfocus="if (this.value==\''.$value.'\') this.value = \'\' "/>'; } if (!isset($value)) { echo '<label for="'. $name .'">'. $lable .'</label><input type="'.$type.'" name="'. $name .'" id="'

How to remove default value of input on focus

大兔子大兔子 提交于 2019-12-03 07:07:48
问题 I have an input box that has default value text assigned to it. How can I remove this text when the user focuses on the field:: CoDE <input type="text" name="kp1_description" value="Enter Keypress Description"> 回答1: $(document).ready(function(){ var Input = $('input[name=kp1_description]'); var default_value = Input.val(); Input.focus(function() { if(Input.val() == default_value) Input.val(""); }).blur(function(){ if(Input.val().length == 0) Input.val(default_value); }); })​ That should do it

Vue.JS value tied on input having the focus

不问归期 提交于 2019-12-02 23:26:06
Is there a way to change a value in the model when an input gets/loses focus? The use case here is a search input that shows results as you type, these should only show when the focus is on the search box. Here's what I have so far: <input type="search" v-model="query"> <div class="results-as-you-type" v-if="magic_flag"> ... </div> And then, new Vue({ el: '#search_wrapper', data: { query: '', magic_flag: false } }); The idea here is that magic_flag should turn to true when the search box has focus. I could do this manually (using jQuery, for example), but I want a pure Vue.JS solution.