Issue
Is there any samples , In blocking special character on key press or onblur event for react textArea box.
Since reactTextArea does have a call onClick event which calls the function to process the request in post method.
Solution
You could use a regular expression for special characters and replace them all with an empty string.
Example
class App extends React.Component {
state = { value: "" };
onChange = event => {
this.setState({ value: event.target.value.replace(/[^\w\s]/gi, "") });
};
render() {
return <input value={this.state.value} onChange={this.onChange} />;
}
}
ReactDOM.render(<App />, document.getElementById("root"));
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<div id="root"></div>
Answered By - Tholle
Answer Checked By - - Cary Denson (ReactFix Admin)