onfocus

jQuery Validate resetForm() doesn't reset the onFocus validation

痴心易碎 提交于 2019-12-13 11:34:57
问题 I have a form that is using jQuery Validate plugin for client side validation, and submits via AJAX. After the form is submitted, I would like it to reset itself. I have used the .resetForm() method to reset the fields, which works, but the problem is that the validate plugin still immediately tries to validate fields when they're focused, and gives an error before giving the new submission a chance to enter their input. Example Flow: Trigger validation initially Fix Validation, submit form

How change search btn on focus input?

和自甴很熟 提交于 2019-12-13 03:04:40
问题 How change search btn on focus input? The initial state: <form action=""> <input type="text" placeholder="Search"> <button type="submit">Search</button> </form> What I want to get on focus of input. I need use only css, not js. <form action=""> <button type="submit">Search</button> <input type="text" placeholder="Search"> </form> How make it? 回答1: Create a flex container on the form and style the button with order: -1 if it's focused. This will allow the button to appear before the input

Jquery - Differentiate between 'click' and 'focus' on same input when using both

最后都变了- 提交于 2019-12-12 19:19:11
问题 I'm trying to trigger an event on an input if the input is clicked or if the input comes in to focus. The issue i'm having is preventing the event from firing twice on the click as, obviously, clicking on the input also puts it in focus. I've put a very loose version of this on jfiddle to show you what I mean, code as below: HTML: <body> <input type="textbox" name="tb1" class="input1"></input> <label> box 1 </label> <input type="textbox" name="tb2" class="input2"></input> <label> box 2 <

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

做~自己de王妃 提交于 2019-12-12 09:54:55
问题 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

Focus is running before the click/change of a radio button. Is it possible to run the click/change before the focus?

本小妞迷上赌 提交于 2019-12-12 03:18:33
问题 Below you will see the code I am working on and an included JSFiddle. Issue: The focus is running before the click/change so the margin is moving before the radio button can be selected. Please explain the code so I can learn from this. If you do not have a solution any hints or direction would also be helpful. Thanks in advance! http://jsfiddle.net/nLgqhqwc/6/ HTML <div class="panel"> <input type="text"/> </div> <div class="panel"> <input type="text"/> </div> <div class="panel"> <select>

How to set input:focus style programatically using JavaScript

不想你离开。 提交于 2019-12-10 17:24:23
问题 I'm building a UI library in JS that can, without relying on any CSS stylesheets, create UI components, stylised from code. So far, it's been quite easy, with exception of styling different control states (such as input:focus one). Code that I use to create input field: function newInput() { var ctr = docmuent.createElement("input"); ctr.setAttribute("type","text"); ctr.setAttribute("value", some-default-value); ctr.style.fontFamily = "sans-serif,helvetica,verdana"; /* some font setup here,

Android (Lollipop) EditText onFocus fired multiple times

纵饮孤独 提交于 2019-12-10 06:18:16
问题 I have a couple of EditTexts with onFocusChangeListeners // When the field gains or loses focus txtMinimumValue.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { editFocusChange(view, hasFocus); } }); I'm not having any issues on pre-Lollipop devices, but any Nexus 5's and the onFocusChange is fired about 7 times. I found this SO: Custom ListAdapter consisting of EditText lose focus called twice and then I found this

scrollTo after focus/onClick event works only after second click

若如初见. 提交于 2019-12-08 12:17:23
问题 I try to scroll to specific point when the user click on edittext, so added the following code to listen to click and focus on this edittext: et_email = (EditText) view.findViewById(R.id.editEmail); //bring to center of screen when clicked / focused et_email.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ScrollView scrollView = (ScrollView)getView().findViewById(R.id.ScrollViewSendDetails); scrollView.smoothScrollTo(0, 500); } }); et_email

auto change keyboard language using javascript not work without IE

霸气de小男生 提交于 2019-12-08 08:52:11
问题 i have a Java Script Code that can change Keyboard Language when focus on text box. but this code just work in IE and cant work correctly in Firefox or Opera my code : <script type="text/javascript" language="javascript"> var farsi = true ; var s = new Array(32,33,34,35,36,37,1548,1711,41,40,215,43, 1608,45,46,47,48,49,50,51,52,53,54,55,56, 57,58,1603,44,61,46,1567,64,1616,1584,125, 1609,1615,1609,1604,1570,247,1600,1548,47, 8217,1583,215,1563,1614,1569,1613,1601, 8216,123,1611,1618,1573,126

Android On Focus Listener and On Click Listener on ImageView

让人想犯罪 __ 提交于 2019-12-08 01:56:51
问题 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) {