If you used input, then there are several options available to you with the attribute type, for example color, date, email, number, tel. See https://developer.mozilla.org/en/docs/Web/HTML/Element/Input .
Since textareayou do not have these options. However, you can use JavaScript to listen for key events and to ignore some keystrokes. See http://jsfiddle.net/tg300eef/ .
var ta = document.getElementById("ta");
ta.addEventListener(
'keypress',
function (e) {
if (e.keyCode == 60) {
alert('No "<"!');
e.preventDefault();
}
}
);
This, however, does not protect you from incorrect or malicious entries. That is, even if you use JavaScript to filter characters from a text field, it is still trivial for the user to circumvent this restriction (for example, disable JavaScript).
, , SQL- HTTP-, .. - . mysqli_real_escape_string MySQL, htmlspecialchars HTML, urlencode HTTP- .. , ( , ), .
, . , , . HTML, , <script> <iframe>, , <strong> <h1>. SQL .
, , , ( , ) , , , . , , Markdown, HTML .
, , . , 0 < x > 10, HTML 0 10 .