My code is working great when the user input first character as a white space but if user insert a string and come back to first position then it take white space. How I prevent user to do this ? "#M1_7_othe" this is the id of input box.
$(function(){
var pp;
$("#M1_7_other").keydown(function(event) {
pp =$("#M1_7_other").val();
if( ($("#M1_7_other").val().length) == 0 ) {
if( event.keyCode == 32 ) {
return false;
}
}
});
});