After max characters per line in textarea, text in next line

Aug 16 2017 7:28 AM

0down votefavorite

I have a Radtextbox. I have implemented the maximum characters per line and limit in number of lines.

But I need your help that, after the maximum character limit per line text should go to next line.

For Example:

  1. My Character per line is 10, if I entered 11 character it should go to next line instead of alert.
Code:
 
function ValidationAddress() {

var allText;
allText = document.getElementById("<%= txtAdd1.ClientID %>").value;
allText = document.getElementById('<%=txtAdd1.ClientID%>').value;
var A = allText.split('\n');
var L = A.length;

if (L > 3 && event.keyCode != 8 && event.keyCode != 46) {
alert("You have exceeded maximum limit.Cannot insert more than 3 lines.");
valert = false;
return false;
}
var arr = allText.split("\n");
for (var i = 0; i < arr.length; i++) {
if (arr[i].length > 10) {
alert("You have exceeded the Maximum Limit..Characters per line is 70 in Address Field !");
valert = false;
return false;
}
}
}
 

Answers (2)