Thank you! When you get to it it will be lovely if you can share the results ^^ I will share mine if I can put it to work and fix these annoyances. Or maybe I can post what I already have and maybe we can fix it somehow when you have time?
I tried the onblur() thing, but it didn't seem to do anything xD I will investigate on how to use it. Makes sense to only avaliate the full word after clicking away or tabbing
(and thank you, I agree on that xD I will keep echo'ing then, I don't know how much javascript I will need - I will probably only have that stuff in the register page plus in another page, so there's really no need to include it everywhere I guess)
---------------------------------------------------------
So with tabbing, it seems to work perfectly. With anything else like clicking outside it keeps spazzing out: Without me doing anything it will keep reading the full word, then half the word, then just one letter lol xD
The current code is like this:
PHP Code:
$(document).ready(function(){
var ready = 0;
$('input#username').keydown(function(e){
$('.div07').html('<i>Loading...</i>');
var key = e.which;
var username = $(this).val();
if(key == 9)
{
$.post('/register/checkusername', {username:username},function(result) {
if(ready == 0){ if(result[0] != '0'){
$('.div07').html('<i>Username is empty or is already being used:</i>' + username)}
else{
$('.div07').html('<i>Username can be used:</i>' + username)}
}});
}
else{
$('input#username').focus(function(){
//var username = $(this).val();
});
$('input#username').focusout(function(){
username = $(this).val();
$.post('/register/checkusername', {username:username},function(result) {
if(ready == 0){ if(result[0] != '0'){
$('.div07').html('<i>Username is empty or is already being used:</i>' + username)}
else{
$('.div07').html('<i>Username can be used:</i>' + username)}
}});
});
}
});})
This seems to somewhat work (with the focus and tabbing you recommended!) Thank you!