Say we have HTML input control with type text for accepting Name from the user.Here we should not allow special characters to be entered except few characters like (',-).for doing this in HTML we will create Javascript function which does this and call this function on onkeypress" event.function ValidateName(name,e) { // To handle copy paste scenarios // replace unmaching characters in