title: No support for indexOf in IE 8?
body: <p>I have a requirement where I create radio buttons dynamically based upon JSON response. So far what I did works in Chrome and firefox, but gives <code>Object doesn't support this property or method</code> on <code>if(subItem[1].indexOf(",") &gt;= 0)</code> line</p>
  
  <p>My code</p>
  
  <pre><code>$("#sList").live("change", function(){
      var currentService=this.value;
      var c1Svc=[];
      var c2Svc=[];
  
      if(absP.length==2)
      {
          $.each(compareServiceData,function(i,item){
  
              if(currentService==item[0])
              {
                  var configCount=0;
                  $.each(item[1],function(j,subItem){
  
                      var temp=subItem[1];
  
                      /*The JSON response contains List of Lists, so here if it contains a list it will be separated by "," so split it and store in a array, else directly store in a array*/
                      if(subItem[1].indexOf(",") &gt;= 0)
                      {
                          var tList=temp.split(",");
                          $.each(tList,function(k,val){
                              if(configCount==0)
                              {
                                  c1Svc.push(val);                                
                              }
                              else
                              {
                                  c2Svc.push(val);                                
                              }
                          });
                      }
                      else
                      {
                          if(configCount==0)
                          {
                              c1Svc.push(subItem[1]);                             
                          }
                          else
                          {
                              c2Svc.push(subItem[1]);                             
                          }
                      }
                      configCount++;
  
                  });
              }
  
          });
  
          if ($("#customServiceListing").length == 0)
          {               
              $("#compareContent").append('&lt;table id="customServiceListing" align="center" width="90%" class="csm-table" border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;form id="c1Service"&gt;&lt;/form&gt;&lt;/td&gt;&lt;td&gt;&lt;form id="c2Service"&gt;&lt;/form&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;');
          }
          else
          {
              $('#c1Service').empty();
              $('#c2Service').empty();
          }
  
      }
      else
      {
          $("#compareContent").append('&lt;table align="center" width="90%" class="csm-table" border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;form&gt;&lt;select id="c1Service"&gt;&lt;/select&gt;&lt;/form&gt;&lt;/td&gt;&lt;td&gt;&lt;select id="c2Service"&gt;&lt;/select&gt;&lt;/td&gt;&lt;td&gt;&lt;select id="c3Service"&gt;&lt;/select&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;');
      }
  
  
      /*adding service radios to config1*/
      $.each(c1Svc,function(i,item){
          $("#c1Service").append('&lt;input type="radio" name="customConfig1ServiceNames" id="'+item+'" value="'+i+1+'"/&gt;'+item);
      });
      if(c1Svc.length&gt;1)
          $("#c1Service").append('&lt;br/&gt;');
  
      /*adding service radios to config2*/
      $.each(c2Svc,function(i,item){
          $("#c2Service").append('&lt;input type="radio" name="customConfig2ServiceNames" id="'+item+'" value="'+i+1+'"/&gt;'+item);
      });
      if(c2Svc.length&gt;1)
          $("#c2Service").append('&lt;br/&gt;');
  });
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p><a href="https://stackoverflow.com/questions/2790001/fixing-javascript-array-functions-in-internet-explorer-indexof-foreach-etc">Here</a> is a List of various function code not supported by IE8</p>
  
  <p><strong>Update</strong>
  What is the problem here, for every value it gives me <code>-1</code> I am using code given by Sudhir</p>
  
  <p><code>alert(subItem[1].indexOf(",")+", "+subItem[1]);</code></p>
  
  <p>Screenshot</p>
  
  <p><img src="https://i.stack.imgur.com/46qGE.png" alt="enter image description here"></p>
  
  <p><strong>Update</strong></p>
  
  <p>Got it here, <code>var temp=subItem[1].toString();</code> was the problem, converting it to String worked.</p>