Set focus to field in dynamically loaded DIV

The load() function is an asynchronous function. You should set the focus after the load() call finishes, that is in the callback function of load(), because otherwise the element you are referring to by #header, does not yet exist. For example: $(“#display”).load(“?control=msgs”, {}, function() { $(‘#header’).focus(); }); I had issues myself even with this solution, … Read more

How do I set the focus to the first input element in an HTML form independent from the id?

Although this doesn’t answer the question (requiring a common script), I though it might be useful for others to know that HTML5 introduces the ‘autofocus’ attribute: <form> <input type=”text” name=”username” autofocus> <input type=”password” name=”password”> <input type=”submit” value=”Login”> </form> Dive in to HTML5 has more information.

How to remove focus from SearchView?

I want to remove focus and text from SearchView in onResume() To achieve this you could set your root layout focusable with the android:focusableInTouchMode attribute and request focus on that View in onResume(). For example: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/root_layout” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” android:focusableInTouchMode=”true”> <SearchView android:id=”@+id/search_view” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:iconifiedByDefault=”false”/> </LinearLayout> And then in your … Read more

Set focus on an input with Ionic 2

You don’t need to import the ‘Input’ from ‘angular/core’. Simply: import {Component,ViewChild} from ‘@angular/core’; import {NavController, TextInput } from ‘ionic-angular’; @Component({ templateUrl: ‘build/pages/home/home.html’ }) export class HomePage { @ViewChild(‘input’) myInput: TextInput; constructor(private navCtrl: NavController) { } ionViewDidLoad() { setTimeout(() => { this.myInput.setFocus(); },150); } } And answering comment to Ciprian Mocanu: It does not work … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)