相关疑难解决方法(0)

根据Javascript中的换行符解析子串中的textarea

我有一个需要解析的文本区域.需要拔出每个新线路并且需要对其执行操作.操作完成后,需要在下一行运行操作.这就是我现在所拥有的.我知道indexOf搜索不起作用,因为它逐个字符地搜索.

function  convertLines()
{
trueinput = document.getElementById(8).value;  //get users input
length = trueinput.length; //getting the length of the user input
newinput=trueinput;  //I know this looks silly but I'm using all of this later
userinput=newinput;
multiplelines=false; //this is a check to see if I should use the if statement later
    for (var i = 0; i < length; i++) //loop threw each char in user input
        {
            teste=newinput.charAt(i); //gets the char at position i
            if (teste.indexOf("<br />") != -1) //checks if …
Run Code Online (Sandbox Code Playgroud)

javascript

11
推荐指数
2
解决办法
2万
查看次数

如何在html文本区域中逐行阅读文本?

如何逐行读取文本区域的内容或将文本拆分为不同的行以获取文本行的输入.

javascript jquery html5 dom textarea

5
推荐指数
2
解决办法
1万
查看次数

我想要以相同的格式在 TextArea 中输入的文本

我使用的是AntDesign的TextArea,当我在其中输入2-3个段落,然后按回车键将其显示为一行时,它会在一个段落中显示所有内容。我想要我在文本区域中输入时所做的精确格式。怎么做?

我只是使用文本区域 -

  <TextArea
     rows={2}
     style={{ width: "100%" }}
     defaultValue={this.state.value}
     onClick={this.handleValue}
  />
Run Code Online (Sandbox Code Playgroud)

并显示在右侧 -

  <div>{this.state.value}</div>
Run Code Online (Sandbox Code Playgroud)

预期的

Hey, how are you doing today? I am fine. i hope your are fine

do give me a call when you are free.

contact - 1234567890
Run Code Online (Sandbox Code Playgroud)

我得到了什么结果

Hey, how are you doing today? I am fine. i hope your are fine do give me a call when you are free. contact - 1234567890
Run Code Online (Sandbox Code Playgroud)

html reactjs antd ant-design-pro

1
推荐指数
1
解决办法
6301
查看次数

标签 统计

javascript ×2

ant-design-pro ×1

antd ×1

dom ×1

html ×1

html5 ×1

jquery ×1

reactjs ×1

textarea ×1