Reputation: 13208
I'm completely stuck.. I tried a few things. I want to lose the focus of a textbox when a user clicks on it.
I tried this:
$('.tagit-input[type=text]').focus(function(){
$('.tagit-input[type=text]').blur();
});
as well as this, where I am giving the focus to a different text box instead:
$('.tagit-input[type=text]').focus(function(){
$('.tagit[type=text]').focus();
});
as well as various methods in keydown
etc. Is there something I'm missing? I'm just trying to lose focus of one box with a class .tagit-input
Upvotes: 0
Views: 3048
Reputation: 572
If your only desire is to lose the focus of the element when focused-on, you can just trigger the .blur() DOM event as the handler when the .focus() event is called or to select another element to focus, do the same and in addition, just trigger a focus on the desired element.
$('.tagit-input[type=text]').focus(function(){
$('.not-tagit-input[type=text]').focus();
});
Upvotes: 0