I have a box for user input, but I need it to be an input area that can be used like a notepad and not just one line.
I made a text area but when I try to regex the value, it does not handle it and ignores the regex.. but an input handles the regex..
Why is this and how can I regex a text area's input?
<div class='container' >
<div class='listtitle' title='Describe Your Items & Give Your Listing as Much Detail As You Can' >Info<br>
<h5>Give Your Listing as Much Detail As You Can.</h5>
</div>
<div id ='infofooter' class='listfooter'>Max Letters: 250</div>
</div><!--container2--->
<script>
$(document).ready(function () {
$('#infovalue').keyup(checkinfo);
});
function checkinfo() {
var info = $("#infovalue").val();
var infoReg = /^[a-zA-Z][a-zA-Z0-9-+&%#=?<>()£~_\.*!, ]{3,54}$/;
if(!infoReg.test(info)) {
$("#infofooter").text("0-250 Standard Characters Please!"), $( "#infovalue" ).addClass( "errorclass" ), $( "#infovalue" ).removeClass( "noerrorclass");
}
if(infoReg.test(info)) {
$("#infofooter").text("info Is Good, Thanks!"), $( "#infovalue" ).addClass( "noerrorclass" ), $( "#infovalue" ).removeClass( "errorclass");
}
var infoB = document.getElementById('infovalue');
var regex= lots/ of/ bad/ words/ - /edited /for /obvious /reasons/gi;
infoB.text=infoB.text.replace(regex, "****");
};
//changed .text to .val .value also to no avail.
</script>