this isthe code that can help you what is the actual problem
<html>
<head>
</head>
<body>
<textarea cols="20" rows="7" id="someval">
</textarea>
<br>
<input type="button" onClick="showData();" value="CheckValue"/>
<script type="text/javascript">
function showData(){
var multiLineString ="This is some Text
this is another text";
document.getElementById('someval').innerHTML=multiLineString;
}
</script>
</body>
</html>
I am using JSTL(JSP StandardTag Library)
I ma getting value from my db exactly in this format but as like in this case when you run this script in a single browser check console I am getting similar error in my case to
“unterminated string literal”
I hope now you got some more Information about my problems
I think that you should always assume that a textarea may have a newline in it - no detection needed. Based on that assumption you should always escape the text when you are embedding it as javascript code.
Ok Just one question if you had to store textarea value in the database to preserve all the newlines user has typed how you will store that data of textarea in database and retrieve back in web page using JavaScript
I am just asking there is a Multiple line textarea in your application suppose you have to preserve all the line breaks that user has typed while typing in textarea fields and
you need to show that back in your front end(overlook what is server side lenguage it can be JSP,PHP,.net)
and one more thing like in case of sitepoint while I am typing I can take a nuber of line break but in actual output it just outputs after a single line How can I do that?
first add this library at the top of your JSPpage
and then there is a replace functions that replace all fields
But Now I have just one question suppose If User has types more than one time enter button
suppose 10 times then the text is displaying at the 10th line so all 9 rows are wasted
So like here on sitepoint also if we type more than one enter space it only takes just one para space in the output box How can I do this?