我想,要检查我的textarea的价值几乎是一样的,需要例如相同:如何检查是否文本几乎是必需的
我有一个HTML代码:
<textarea class="ab" placeholder="Type here"></textarea>
<div class="result">
</div>
和jQuery代码:
$(document).ready(function(){
$(".btn").click(function(){
var a = $(".ab").val();
var b = $(".result").html();
/* */
if(a.indexOf('Which of the following is generally true about Open Source software?') >= 0){$('.result').html('Its usually developed on a volunteer basis and anyone is free to change it (correct).');} /* */
else{
$(".result").html("error");
}
});
});
此代码不起作用正如我真正想要的,这正是我试图使。但我想的东西是例如当$('.ab')
的值几乎一样的文字Which of the following is generally true about Open Source software?
像the following is generally true
或true about the Open Source
,在$(".result")
仍然有HTML作为Its usually developed on a volunteer basis and anyone is free to change it (correct).
让我怎么做,谢谢您的帮助
没有简单的解决办法,这样做我研究模糊搜索。问题过于宽泛,没有更精确的搜索标准 – charlietfl
如果十个输入单词中的五个匹配字符串,做什么要求? – guest271314