Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用jquery删除包含_Javascript_Jquery_Html - Fatal编程技术网

Javascript 使用jquery删除包含

Javascript 使用jquery删除包含,javascript,jquery,html,Javascript,Jquery,Html,我想使用jquery创建包含的删除行,下面是我的代码: <body> Search lines for: <input type="text" id="search-lines" value="Sometimes|relevance|understand" style="width:100%; margin-top:10px;" /> <button id="process&q

我想使用jquery创建包含的删除行,下面是我的代码:

<body>
Search lines for:
<input type="text" id="search-lines" value="Sometimes|relevance|understand" style="width:100%; margin-top:10px;" />
<button id="process">Process!</button>
<textarea id="input" style="width:100%; margin-top:10px; height:150px; resize:none;" wrap="off">Sometimes to understand a word's
meaning you need more than a definition.
At Your Dictionary we try to give you all of the tools
you need to really understand what the word means.
Seeing the word in a sentence can
provide more context and relevance.</textarea>
<textarea id="containing-output" rows="4" style="width:100%; margin-top:10px; height:150px; resize:none;" wrap="off"></textarea>
<textarea id="not-contating-output" rows="4" style="width:100%; margin-top:10px; height:150px; resize:none;" wrap="off"></textarea>
</body>

搜索以下内容的行:
过程
有时为了理解一个词的意思
这意味着你需要的不仅仅是一个定义。
在你的字典里,我们试图给你所有的工具
你需要真正理解这个词的意思。
在一个句子中看到这个词可以
提供更多的上下文和相关性。
这就是它的工作原理:

搜索以下内容的行:

有时|相关性|理解

文本行输入:

有时为了理解一个词的意思

这意味着你需要的不仅仅是一个定义

在你的字典里,我们试图给你所有的工具

你需要真正理解这个词的意思

在一个句子中看到这个词可以

提供更多上下文和相关性

包含行输出:

有时为了理解一个词的意思

你需要真正理解这个词的意思

提供更多上下文和相关性

不包含输出行:

这意味着你需要的不仅仅是一个定义

在你的字典里,我们试图给你所有的工具

在一个句子中看到这个词可以

可以使用数组

var unwantedwords= array(
//create an array of your list of words
)
var sometext=“有时理解一个单词的”//这是你的绳子

for (index = 0; index < unwantedwords.length; ++index) {
var word = unwantedwords[index ];
var check = sometext.indexOf(word)
  if(check !== false)
   {
     removedwordstring = sometext.replace(word,'');
   }
}
然后循环遍历数组并检查这些值,然后将其从字符串中删除

for (index = 0; index < unwantedwords.length; ++index) {
var word = unwantedwords[index ];
var check = sometext.indexOf(word)
  if(check !== false)
   {
     removedwordstring = sometext.replace(word,'');
   }
}
for(索引=0;索引
这个怎么样

$(文档).ready(函数(){
$(“#进程”)。单击(函数(){
var searchCriteria=$(“#搜索行”).val().split(“|”);
//您可以使用\n或拆分。
var data=$('#input').val().split(“\n”);
var匹配=[];
var不匹配=[];
$。每个(数据、函数(i、j){
$.each(搜索条件、函数(索引、值){
如果(j.indexOf(值)>0){
匹配。推送(j.replace(值“+”值+”);
}否则{
不匹配。推(j);
}
});
});
$(“#包含输出”).val(匹配);
$(“#非连续输出”).val(不匹配);
});
});

搜索以下内容的行:
过程
有时为了理解一个词的意思
这意味着你需要的不仅仅是一个定义。
在你的字典里,我们试图给你所有的工具
你需要真正理解这个词的意思。
在一个句子中看到这个词可以
提供更多的上下文和相关性。

您当前的javascript代码在哪里?是的,您需要尝试一下。我们不应该为你开发东西,只是在你的代码不起作用的时候帮你。目前,根本没有代码。