karthik
karthik

Reputation: 17842

Possible to set the focus to same control in onblur event in asp.net

Is it possible to have the focus on same button even after losing the focus.

I kept the code for your reference.

OnSuccess is the blur event for the button btnOK.

    function OnSuccess() {
       document.getElementById('btnOk').focus();
       return true;
    }

During tab press on the btnOK, It loses the focus.How to stay back the focus in the same control?

Upvotes: 0

Views: 702

Answers (1)

Akhil Sekharan
Akhil Sekharan

Reputation: 12683

Try:

function OnSuccess() {
  setTimeout(function(){
       document.getElementById('btnOk').focus();
    }, 0);
   return true;
}

Upvotes: 1

Related Questions