Stackoverflow 2012-03-11
HTML
<div id="text1">Where</div>
<div id="text2">Where</div>
<div id="text3">Where</div>
JavaScript
if (this.value.match(/[^a-zA-Z0-9 ]/g)) {
this.value = this.value.replace(/[^a-zA-Z0-9 ]/g, '');
}
<div id="text1">Where</div>
<div id="text2">Where</div>
<div id="text3">Where</div>
if (this.value.match(/[^a-zA-Z0-9 ]/g)) {
this.value = this.value.replace(/[^a-zA-Z0-9 ]/g, '');
}