Jquery username check
Posted
by Sergio
on Stack Overflow
See other posts from Stack Overflow
or by Sergio
Published on 2010-04-19T17:15:26Z
Indexed on
2010/04/19
17:23 UTC
Read the original article
Hit count: 394
jQuery
I'm using this Jquery function for available username check.
How can I fire this Jquery function only if the username field is greater of 5 characters?
Jquery looks like:
$(document).ready(function() {
$('#usernameLoading').hide();
$('#username').blur(function(){
$('#usernameLoading').show();
$.post("usercheck.php", {
un: $('#username').val()
}, function(response){
$('#usernameResult').fadeOut();
setTimeout("finishAjax('usernameResult', '"+escape(response)+"')", 400);
});
return false;
});
});
function finishAjax(id, response) {
$('#usernameLoading').hide();
$('#'+id).html(unescape(response));
$('#'+id).fadeIn();
} //finishAjax
Can I use something like this and how:
var usr = $("#username").val();
if(usr.length >= 5)
{
}
© Stack Overflow or respective owner