my current issue https://jsfiddle.net/9exp7qwd/2/ My goal is to breakup a paragraph into different sentences with ediblable textarea boxes, each sentence ends with a period so that's when it's suppose to breaking up. I have it seperating the paragraph with zero issues but i can't seem to get the text into the text boxes correctly.
<div type="text" id="testingL"></div>
$(document).ready(function() {
var data = "Fixed missing or non-localized text in some dialogs.Fixed occasional crash when navigating to collections in the library. Fixed display of pending gifts in notification menu. "
$("#testingL").each(function() {
$("#testingL").append("<textarea>" (data) "</textarea>")
$(this).html($(this).text().split(".").join(". </textarea> <textarea>"));
}
)});
CodePudding user response:
Did you mean this?
$(document).ready(function() {
var data = "Fixed missing or non-localized text in some dialogs. Fixed occasional crash when navigating to collections in the library. Fixed display of pending gifts in notification menu. "
let html="";
data.split(/\. /g).forEach(a=>html = a==""?"":("<textarea rows=2 style='width:50%;'>" a "</textarea></br>"));
$("#testingL").html(html);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div type="text" id="testingL"></div>