Hello! I need to find the index of the character in the string. There is an indexOf
function that is ideal, but it does not work in ie7
.
What other options are there? (will go to jquery
too)
Thank.
Hello! I need to find the index of the character in the string. There is an indexOf
function that is ideal, but it does not work in ie7
.
What other options are there? (will go to jquery
too)
Thank.
In the cycle walk:
function indexOf(str, target){ for(var i= 0, l = str.length; i<l; i++){ if(str[i] === target){ return i; } } return -1; }
$.inArray(target, str);
Use Underscore _.indexOf
_.indexOf(str.split(''), target)
Source: https://ru.stackoverflow.com/questions/133399/
All Articles