I want to check if the value of my textarea is almost the same as requires , for example :
I have a HTML code :
<textarea class="ab" placeholder="Type here"></textarea>
<div class="result">
</div>
and a Jquery code :
$(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");
}
});
});
this code doesn't work as what i want actually , this is just what i tried to make . But the thing i want is for example when the value of the $('.ab')
is almost the same as the text Which of the following is generally true about Open Source software?
like the following is generally true
or true about the Open Source
, the $(".result")
still have the html as Its usually developed on a volunteer basis and anyone is free to change it (correct).
So how do i do that , thanks for your help