html
<textarea placeholder="内容框" id="kw"></textarea>
<a id="ll">仅保留字母数字</a>
js
document.getElementById('ll').onclick = function () {
var input = document.getElementById("kw");
var value = input.value;
var newValue = value.replace(/[^a-zA-Z0-9]/g, '');
input.value = newValue; };