Filter textarea input data Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!HTML text input allow only numeric inputConvert form data to JavaScript object with jQueryDisable/enable an input with jQuery?Removing input background colour for Chrome autocomplete?How to remove border (outline) around text/input boxes? (Chrome)Is there any way to change input type=“date” format?How does data binding work in AngularJS?How do I get the value of text input field using JavaScript?Is there a float input type in HTML5?Can't bind to 'ngModel' since it isn't a known property of 'input'

two integers one line calculator

How much damage would a cupful of neutron star matter do to the Earth?

Are the endpoints of the domain of a function counted as critical points?

Why do early math courses focus on the cross sections of a cone and not on other 3D objects?

Mounting TV on a weird wall that has some material between the drywall and stud

What is a more techy Technical Writer job title that isn't cutesy or confusing?

As a dual citizen, my US passport will expire one day after traveling to the US. Will this work?

Tips to organize LaTeX presentations for a semester

Where is the Next Backup Size entry on iOS 12?

Did any compiler fully use 80-bit floating point?

The Nth Gryphon Number

Is multiple magic items in one inherently imbalanced?

Understanding p-Values using an example

Why not send Voyager 3 and 4 following up the paths taken by Voyager 1 and 2 to re-transmit signals of later as they fly away from Earth?

The test team as an enemy of development? And how can this be avoided?

Asymptotics question

Google .dev domain strangely redirects to https

Relating to the President and obstruction, were Mueller's conclusions preordained?

Co-worker has annoying ringtone

How does the math work when buying airline miles?

What is the difference between a "ranged attack" and a "ranged weapon attack"?

Can two person see the same photon?

Printing attributes of selection in ArcPy?

What would you call this weird metallic apparatus that allows you to lift people?



Filter textarea input data



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!HTML text input allow only numeric inputConvert form data to JavaScript object with jQueryDisable/enable an input with jQuery?Removing input background colour for Chrome autocomplete?How to remove border (outline) around text/input boxes? (Chrome)Is there any way to change input type=“date” format?How does data binding work in AngularJS?How do I get the value of text input field using JavaScript?Is there a float input type in HTML5?Can't bind to 'ngModel' since it isn't a known property of 'input'



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















want to achieve such a function



  1. when textarea is submitted to the database, line breaks are removed (eg n --> "bar2019").

  2. data exported from the databased and show, the same effect as div.output (eg "bar2019" --> <bar> || n).

1: when str += "bar2019":



str = str.replace (/bar2019/g, "<br>");



only the last "bar2019" can be replaced



2: when str += "n":



str = str.replace (/n/g, "<br>");



all "n" can be replaced



function filterData(e) 
str = this.value;

if (e.keyCode === 13)
// error: bar2019 ?
// str += "bar2019";
// good: n
str += "n";


console.log(this.value);
// error: bar2019 ?
// str = str.replace(/bar2019/g, "<br>");
// good: n
str = str.replace(/n/g, "<br>");
dataOutput.innerHTML = str;






var dataInput = document.getElementById("dataInput"),
dataOutput = document.getElementById("dataOutput"),
str = "";

function filterData(e)
str = this.value;

if (e.keyCode === 13)
// error: bar2019 ?
// str += "bar2019";
// good: n
str += "n";


// console.log(this.value);
// error: bar2019 ?
// str = str.replace(/bar2019/g, "<br>");
// good: n
str = str.replace(/n/g, "<br>");
dataOutput.innerHTML = str;


dataInput.addEventListener("change", filterData, false);
dataInput.addEventListener("input", filterData, false);
dataInput.addEventListener("keypress", filterData, false);
dataInput.addEventListener("keyup", filterData, false);
dataInput.addEventListener("plate", filterData, false);

.data-filter 
width: 90%;
margin: 20px auto;
overflow: hidden;


.data-filter>textarea,
.data-filter>div
width: 48%;
min-height: 300px;
padding: 10px;
border: 1px solid #aaa;
float: left;


.data-filter>div
color: #f80;

<div class="data-filter">
<textarea name="dataInput" id="dataInput" placeholder="Data input"></textarea>
<div id="dataOutput"></div>
</div>












share|improve this question
























  • What is the error? Are you sure str has a value at all?

    – Lajos Arpad
    Mar 22 at 12:37

















0















want to achieve such a function



  1. when textarea is submitted to the database, line breaks are removed (eg n --> "bar2019").

  2. data exported from the databased and show, the same effect as div.output (eg "bar2019" --> <bar> || n).

1: when str += "bar2019":



str = str.replace (/bar2019/g, "<br>");



only the last "bar2019" can be replaced



2: when str += "n":



str = str.replace (/n/g, "<br>");



all "n" can be replaced



function filterData(e) 
str = this.value;

if (e.keyCode === 13)
// error: bar2019 ?
// str += "bar2019";
// good: n
str += "n";


console.log(this.value);
// error: bar2019 ?
// str = str.replace(/bar2019/g, "<br>");
// good: n
str = str.replace(/n/g, "<br>");
dataOutput.innerHTML = str;






var dataInput = document.getElementById("dataInput"),
dataOutput = document.getElementById("dataOutput"),
str = "";

function filterData(e)
str = this.value;

if (e.keyCode === 13)
// error: bar2019 ?
// str += "bar2019";
// good: n
str += "n";


// console.log(this.value);
// error: bar2019 ?
// str = str.replace(/bar2019/g, "<br>");
// good: n
str = str.replace(/n/g, "<br>");
dataOutput.innerHTML = str;


dataInput.addEventListener("change", filterData, false);
dataInput.addEventListener("input", filterData, false);
dataInput.addEventListener("keypress", filterData, false);
dataInput.addEventListener("keyup", filterData, false);
dataInput.addEventListener("plate", filterData, false);

.data-filter 
width: 90%;
margin: 20px auto;
overflow: hidden;


.data-filter>textarea,
.data-filter>div
width: 48%;
min-height: 300px;
padding: 10px;
border: 1px solid #aaa;
float: left;


.data-filter>div
color: #f80;

<div class="data-filter">
<textarea name="dataInput" id="dataInput" placeholder="Data input"></textarea>
<div id="dataOutput"></div>
</div>












share|improve this question
























  • What is the error? Are you sure str has a value at all?

    – Lajos Arpad
    Mar 22 at 12:37













0












0








0








want to achieve such a function



  1. when textarea is submitted to the database, line breaks are removed (eg n --> "bar2019").

  2. data exported from the databased and show, the same effect as div.output (eg "bar2019" --> <bar> || n).

1: when str += "bar2019":



str = str.replace (/bar2019/g, "<br>");



only the last "bar2019" can be replaced



2: when str += "n":



str = str.replace (/n/g, "<br>");



all "n" can be replaced



function filterData(e) 
str = this.value;

if (e.keyCode === 13)
// error: bar2019 ?
// str += "bar2019";
// good: n
str += "n";


console.log(this.value);
// error: bar2019 ?
// str = str.replace(/bar2019/g, "<br>");
// good: n
str = str.replace(/n/g, "<br>");
dataOutput.innerHTML = str;






var dataInput = document.getElementById("dataInput"),
dataOutput = document.getElementById("dataOutput"),
str = "";

function filterData(e)
str = this.value;

if (e.keyCode === 13)
// error: bar2019 ?
// str += "bar2019";
// good: n
str += "n";


// console.log(this.value);
// error: bar2019 ?
// str = str.replace(/bar2019/g, "<br>");
// good: n
str = str.replace(/n/g, "<br>");
dataOutput.innerHTML = str;


dataInput.addEventListener("change", filterData, false);
dataInput.addEventListener("input", filterData, false);
dataInput.addEventListener("keypress", filterData, false);
dataInput.addEventListener("keyup", filterData, false);
dataInput.addEventListener("plate", filterData, false);

.data-filter 
width: 90%;
margin: 20px auto;
overflow: hidden;


.data-filter>textarea,
.data-filter>div
width: 48%;
min-height: 300px;
padding: 10px;
border: 1px solid #aaa;
float: left;


.data-filter>div
color: #f80;

<div class="data-filter">
<textarea name="dataInput" id="dataInput" placeholder="Data input"></textarea>
<div id="dataOutput"></div>
</div>












share|improve this question
















want to achieve such a function



  1. when textarea is submitted to the database, line breaks are removed (eg n --> "bar2019").

  2. data exported from the databased and show, the same effect as div.output (eg "bar2019" --> <bar> || n).

1: when str += "bar2019":



str = str.replace (/bar2019/g, "<br>");



only the last "bar2019" can be replaced



2: when str += "n":



str = str.replace (/n/g, "<br>");



all "n" can be replaced



function filterData(e) 
str = this.value;

if (e.keyCode === 13)
// error: bar2019 ?
// str += "bar2019";
// good: n
str += "n";


console.log(this.value);
// error: bar2019 ?
// str = str.replace(/bar2019/g, "<br>");
// good: n
str = str.replace(/n/g, "<br>");
dataOutput.innerHTML = str;






var dataInput = document.getElementById("dataInput"),
dataOutput = document.getElementById("dataOutput"),
str = "";

function filterData(e)
str = this.value;

if (e.keyCode === 13)
// error: bar2019 ?
// str += "bar2019";
// good: n
str += "n";


// console.log(this.value);
// error: bar2019 ?
// str = str.replace(/bar2019/g, "<br>");
// good: n
str = str.replace(/n/g, "<br>");
dataOutput.innerHTML = str;


dataInput.addEventListener("change", filterData, false);
dataInput.addEventListener("input", filterData, false);
dataInput.addEventListener("keypress", filterData, false);
dataInput.addEventListener("keyup", filterData, false);
dataInput.addEventListener("plate", filterData, false);

.data-filter 
width: 90%;
margin: 20px auto;
overflow: hidden;


.data-filter>textarea,
.data-filter>div
width: 48%;
min-height: 300px;
padding: 10px;
border: 1px solid #aaa;
float: left;


.data-filter>div
color: #f80;

<div class="data-filter">
<textarea name="dataInput" id="dataInput" placeholder="Data input"></textarea>
<div id="dataOutput"></div>
</div>








var dataInput = document.getElementById("dataInput"),
dataOutput = document.getElementById("dataOutput"),
str = "";

function filterData(e)
str = this.value;

if (e.keyCode === 13)
// error: bar2019 ?
// str += "bar2019";
// good: n
str += "n";


// console.log(this.value);
// error: bar2019 ?
// str = str.replace(/bar2019/g, "<br>");
// good: n
str = str.replace(/n/g, "<br>");
dataOutput.innerHTML = str;


dataInput.addEventListener("change", filterData, false);
dataInput.addEventListener("input", filterData, false);
dataInput.addEventListener("keypress", filterData, false);
dataInput.addEventListener("keyup", filterData, false);
dataInput.addEventListener("plate", filterData, false);

.data-filter 
width: 90%;
margin: 20px auto;
overflow: hidden;


.data-filter>textarea,
.data-filter>div
width: 48%;
min-height: 300px;
padding: 10px;
border: 1px solid #aaa;
float: left;


.data-filter>div
color: #f80;

<div class="data-filter">
<textarea name="dataInput" id="dataInput" placeholder="Data input"></textarea>
<div id="dataOutput"></div>
</div>





var dataInput = document.getElementById("dataInput"),
dataOutput = document.getElementById("dataOutput"),
str = "";

function filterData(e)
str = this.value;

if (e.keyCode === 13)
// error: bar2019 ?
// str += "bar2019";
// good: n
str += "n";


// console.log(this.value);
// error: bar2019 ?
// str = str.replace(/bar2019/g, "<br>");
// good: n
str = str.replace(/n/g, "<br>");
dataOutput.innerHTML = str;


dataInput.addEventListener("change", filterData, false);
dataInput.addEventListener("input", filterData, false);
dataInput.addEventListener("keypress", filterData, false);
dataInput.addEventListener("keyup", filterData, false);
dataInput.addEventListener("plate", filterData, false);

.data-filter 
width: 90%;
margin: 20px auto;
overflow: hidden;


.data-filter>textarea,
.data-filter>div
width: 48%;
min-height: 300px;
padding: 10px;
border: 1px solid #aaa;
float: left;


.data-filter>div
color: #f80;

<div class="data-filter">
<textarea name="dataInput" id="dataInput" placeholder="Data input"></textarea>
<div id="dataOutput"></div>
</div>






javascript regex input keyboard regexp-replace






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 16 at 9:58







Phoenix

















asked Mar 22 at 11:54









PhoenixPhoenix

1618




1618












  • What is the error? Are you sure str has a value at all?

    – Lajos Arpad
    Mar 22 at 12:37

















  • What is the error? Are you sure str has a value at all?

    – Lajos Arpad
    Mar 22 at 12:37
















What is the error? Are you sure str has a value at all?

– Lajos Arpad
Mar 22 at 12:37





What is the error? Are you sure str has a value at all?

– Lajos Arpad
Mar 22 at 12:37












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55299072%2ffilter-textarea-input-data%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55299072%2ffilter-textarea-input-data%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript