$(\"#user\").keyup(function(e){ var regx = /^[A-Za-z0-9]+$/; if (!regx.test(\'#user\')) {$(\"#infoUser\").html(\"Alphanumeric only allowed !\");} );} <
THis line
regx.test('#user')
has you testing the string #user, and that is a string that has a bad character (the #). So it will always say not allowed.
#user
#
Use the actual value of your $("#user") there by using $(this).val()
$("#user")
$(this).val()