ronak barbhaya
ronak barbhaya

Reputation: 73

How can I get focus on hyperlink or button on focus of textfield using jQuery

I have an input text field and a button.

How can I get focus on button with id-'searchref'on focus of my input text field using JQuery?

Upvotes: 0

Views: 75

Answers (1)

elreeda
elreeda

Reputation: 4597

you can use focus() method to bind an event handler to the "focus" JavaScript event, or trigger that event on an element.

$('selector').focus(function(){
    // your code goes here
})

Upvotes: 2

Related Questions