JavaScript forEach loop works in all webbrowser but Internet Explorer -


i've managed loop working in browsers apart internet explorer (which doesn't seem support foreach).

the javascript cpde:

function validate() {     var msg = '';     var = 0;      arr.foreach(         function validateinfo(){             if (getrbtnname('yesno_' + + '_0' == "" && 'yesno_' + + '_0') == "") {                 msg = 'please select yes/no users'             }             if (msg == '') {                 return true;             }             is++;         }     )      if (msg == '') {         reloadpage();     }      if (msg != '') {         alert(msg);         return false;     } }   function reloadpage(){     window.location.reload() } 

the array being set in php file rather passed in. it's being set using:

<script type="text/javascript">     var arr = <?php echo json_encode($arr) ?>; </script> 

just place shim mdn @ beginning of scripts:

if ( !array.prototype.foreach ) {   array.prototype.foreach = function(fn, scope) {     for(var = 0, len = this.length; < len; ++i) {       fn.call(scope, this[i], i, this);     }   } } 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -