javascript - node js : save entered line breaks to mysql? -


how should save user-entered line breaks text area mysql database in nodejs?

i'm trying save every word space , line-breaks textarea. trying save result db in following way

in textarea :

first line second line 

i getting result in manner

first%20linesecond%20line 

i want result in db in following format in text area...

i know if in php have used nl2br() http://id1.php.net/nl2br want know , use in nodejs.

how should it?

i have never worked in nodejs, should work in js environment.

function nl2br (str, is_xhtml) {   var breaktag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br ' + '/>' : '<br>';        return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breaktag + '$2'); } 

reference


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -