Below code disables 0 as the first character in #foo. However, you can bypass this by typing 123, then drag to select 123
0
#foo
123
If you want to catch the changes to the input's value (including the changes made by dragging part of the text for example), you can watch the input event.
$('input#foo').on("input", function(){ alert($(this).val()); });