jquery, set focus on the first enabled input or select or textarea on the page
$(‘:input:enabled:visible:first’).focus();
$(‘:input:enabled:visible:first’).focus();
I recently fixed this problem for a login splash screen that is being displayed via a storyboard when the main window is first loaded. I believe there were two keys to the fix. One was to make the containing element a focus scope. The other was to handle the Storyboard Completed event for the storyboard … Read more
So, (as mentioned in the comments) that gray fill you see isn’t actually an active class being applied – it’s the focus selection behaviour of that particular Bootstrap button element. (Like the dotted outline of a hyperlink.) Try pressing Tab after clicking a button, and you should see the focus selection change. One way to … Read more
This might help… http://api.jquery.com/blur/ $(‘#tabName’).blur();
I encountered a similar issue. I need to unfocus a textbox when enter is pressed. I end up with this code: var scope = FocusManager.GetFocusScope(elem); // elem is the UIElement to unfocus FocusManager.SetFocusedElement(scope, null); // remove logical focus Keyboard.ClearFocus(); // remove keyboard focus I think it is cleaner than creating dummy controls and it is … Read more
By far the simplest solution is to set the TabIndex property correctly so that your ‘MyDropDownList’ control has the lowest index. The next approach is to do it in the constructor. But you have to use Select(), the Focus() method cannot work yet because the control doesn’t become visible until later. Public Sub New() InitializeComponent() … Read more
Ok I managed to get it working: Builder builder = new Builder(this); final EditText input = new EditText(this); builder .setTitle(R.string.dialog_title_addsubject) .setMessage(R.string.dialog_addsubject) .setView(input) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String value = input.getText().toString(); if (input.getText().toString().trim().length() == 0) { Toast.makeText(Main.this, R.string.input_empty, Toast.LENGTH_SHORT).show(); } else { db.insertSubject(value); getData(); } InputMethodManager imm = (InputMethodManager) … Read more
I had problems triggering focus on an element (a form input) that was transitioning into the page. I found it was fixable by invoking the focus event from inside a setTimeout with no delay on it. As I understand it (from, eg. this answer), this delays the function until the current execution queue finishes, so … Read more
Finally found an answer… use the command: tinymce.execCommand(‘mceFocus’,false,’id_of_textarea’); For my purposes, ‘id_of_texterea’ was “description”, ie <textarea id=”description” … ></textarea> In the form element that preceded my textarea, I added the execCommand above to the element’s “onblur” action.
Call the GetChildIndex and SetChildIndex methods of the parent’s Controls collection.