Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
52
rated 0 times [  55] [ 3]  / answers: 1 / hits: 39554  / 11 Years ago, fri, october 25, 2013, 12:00:00

Why javascript contains property is not working in chrome browser?
I have tried that Contains Property in javascript.It is working fine in Mozila Firefox Browser. But It is not working in Chrome browser.How to fix this?



Link: http://www.codingslover.com/2014/11/why-javascript-contains-property-is-not.html



var ClearFilterValue='family Schools';
if(ClearFilterValue.contains(family)== true) {
alert('Success');
}

More From » javascript

 Answers
28

indexof returns the position of the string. If not found, it will return -1:



var ClearFilterValue = 'family Schools';
alert(ClearFilterValue.indexOf(family) != -1);

[#74730] Thursday, October 24, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tyemathewj

Total Points: 484
Total Questions: 107
Total Answers: 111

Location: Equatorial Guinea
Member since Sun, Feb 14, 2021
3 Years ago
;