$(document).ready(function(){
var CurrentTextBoxID = "";
var shifton = false;
var IsCapsLockOn = false;
// toggles the keyboard to show or hide when link is clicked
$(":text").focus(function(e) {
CurrentTextBoxID = this.id;
var top = ($(window).height() - $('#keyboard').height()) - 25;
var left = ($(window).width() - $('#keyboard').width()) / 2;
alert(CurrentTextBoxID + " focus In");
$('#keyboard').css(
{
"left": left+"px",
"top": top+"px"
}
).toggle();
});
$('#'+CurrentTextBoxID).blur(function() {
alert("**");
});
$('#'+CurrentTextBoxID).focusout(function() {
alert(this.id + " focus out");
});
At this upper code, blur function and focusout function did not work.
When I change code like that it work.
$('#txtTest1').blur(function() {
alert("**");
});
$('#txtTest1').focusout(function() {
alert(this.id + " focus out");
});
But by changing code like that, I cannot give text box ID dynamically.
So, Please let me know how could i make like that.
$( DYNAMIC ID ).focusout(function() { .... });
As I feel you need to bind those
blurandfocusoutfunction for all text boxes. If you do it one by one infocus(as in the answer of @Gabe)function you will be binding that function again when some nextfocusevent happens.I think you need to do like this,