Hi, Does anybody know how the username input field of Twitter works? In the registration form, if you type any UTF-8 character it will not be rendered. How is that done?
yeah, thats obvious right!?
2009-09-22 20:25:53
Yes, fiXedd is right :) The code is here: https://s3.amazonaws.com/twitter_production/a/1253569923/javascripts/signup.js?1253571264
lost-theory
2009-09-22 20:32:20
@George, then what are you asking?
fiXedd
2009-09-22 21:06:23
A:
I use the following jQuery code for my site. It differs slightlty from Twitter as they allow underscores and I don't.
$(function(){
$('input[name="username"]').keydown(function(key){
if (jQuery.inArray(key.keyCode, [8,37,39,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90]) == -1 || key.shiftKey ){
return false;
}
});
});
knorthfield
2009-10-19 13:46:28
Ok, that javascript looks horrible. Any tips on making it look nice?
knorthfield
2009-10-19 13:53:47
A:
$('.sample2').alphanumeric({allow:"., "});
this code only allow to type alpha numeric and alow some special characters
sample2 this is your text field class
i hope this will help you
gowri
2010-09-07 16:55:58