Click here to Skip to main content
15,886,773 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi

When trying excute this i ma gertting error like0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'contains' but it works in other browser can any one help me out
C#
for (var i = 0; i <= dealVar.length; i++) {
  if (dealVar[i]!=null && dealVar[i].contains('key')) {
    var option = document.createElement('option');
    var str = dealVar[i].split(',');
    var str1 = str[0].split(':');
    var str2 = dealVar[i+1].split(':');

    option.setAttribute('value', str1[1]);

    option.appendChild(document.createTextNode(str2[1]));
    element1.appendChild(option);
  }
}
Posted
Updated 25-Nov-14 20:22pm
v4

1 solution

JavaScript Array's contains method is a non standard method (it comes from the proposal of ECMA)!
There is an old and good method called indexOf[^] that supported in all browsers including IE (9+)...
 
Share this answer
 
Comments
murkalkiran 26-Nov-14 3:26am    
Thank u Very much Kornfeld Eliyahu Pete

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900