In my form, I have a textarea field where user can enter data and press ‘Enter’ to put line breaks and continue entering data.
When I am retrieving data from the database, I need to remove all line breaks and store that data in a a JavaScript array.
In the example below, I am retrieving a note (which contains several line breaks <br/>) and storing in in an array called ‘exp_from_db’
exp_from_db[1]= '<%= note.NOTE_VALUE %>';
My question is how do I remove those line breaks in <%= note.NOTE_VALUE %> before storing it in the javascript array.
Thanks for your help.
If the string
<br/>and variations of it (<br>,<br />,<br >) are all you want to remove,gsubis one wayIf you always want to strip this, you can modify the getter for
NOTE_VALUEin the ActiveRecord class