AnsweredAssumed Answered

Read and Clear the last line of Multiline Textbox, using JavaScript

Question asked by on May 24, 2017
Latest reply on May 28, 2017 by sojanm

I have a Multiline Textbox with with multiple lines of data in it.

Using Javascript, I want read just the last line in a variable and then remove/delete the last line from the control.


On button Click I am able to write the data to the Control.

var OldData = NWF$('#'+ fldMultiLine).val();
var NewData = 'This could be any data';
NWF$('#'+ fldMultiLine).val(OldData + (OldData.length ? '\r\n' : '') + NewData);


On button Click I am also able to delete all the data from the control

NWF$('#'+ fldMultiLine).val('');


What I need is to, On button click just -

1) Read the last line into a variable,

2) Then, delete only the last line from the control.


I would appreciate any help extended.