Answers for "jquery if variable contains text"

1

jquery if variable contains text

var text = "hello world";
var term = "hello";

if( text.indexOf( term ) != -1 ){
  alert("true");
} else{
	alert("false")
}
Posted by: Guest on April-11-2022

Code answers related to "jquery if variable contains text"

Code answers related to "Javascript"

Browse Popular Code Answers by Language