How do you get the focus off a button?

Asked

Viewed 341 times

0

I have a button and the same after the click I would like to remove the focus using javascript, detail do not use mouse using this button on a screen touch, no mouse or keyboard. I use the following function today to go up and down the screen:

$(document).ready(function(){
    $('#up').click(function(){
         $('html, body').animate({scrollTop : $(window).scroll().scrollTop()-500},800);
    });   

    $('#down').click(function(){
         $('html, body').animate({scrollTop : $(window).scroll().scrollTop()+500},800);
    });
});

I need the clicked button to go out of focus.

  • 2

    Have you tested $(this).blur() inside the Event Handler?

  • 1

    Yes tests the $(this). Blur() does not work for this case.

  • @Catanarahmeier, you would like to take the focus for a style issue (the btn is with the edge), or is getting in the way of functionality ?

  • One possibility would be to set the focus to another field.

  • I would like to change more for the sake of style. Setting the focus to another field is a possibility, I will try this on Monday, thank you...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.