jquery validator no space 1

jquery validator no space

        $('#IdElement').keypress(function (e) {
            if (e.which === 32)
                return false;
        })

Here is what the above code is Doing:
1. When the user clicks on the input field, the placeholder text disappears.
2. When the user clicks outside the input field, the placeholder text reappears if the user hasn’t typed anything.
3. When the user starts typing, the placeholder text disappears.
4. When the user presses the spacebar, it doesn’t add a space.

Similar Posts