is there any reason why this wouldn’t be working?
var caseString = "sliderInput";
var theString = caseString.substring(1, 2);
I put it through the Firebug debugger in Firefox and it is giving me the error:
“invalid assignment left-hand side.”
** here is my exact code
var elements = new Array();
elements = document.getElementsByTagName("Input");
var allSliderInputs = new Array();
var sliderParams = new Array();
var first, last, inc, style;
for (var i=0; i < elements.length ; i++){
var c = elements[i].className; //works fine here
var t = c.substring(0, 2); //when it hits this line it says "invalid assignment left-hand side"
}
substringis 0-indexed so you should instead do something like this:Also take note that .slice() does the same thing but is actually more powerful, because it can count backwards as well as forwards.
To solve your new problem I would suggest a few things:
getElementsByTagNameis live meaning any changes to your list while you’re looping will effect that value, so it won’t behave as you’d expect.new Array()it’s overly fancy.Try this:
This works fine for me in Firefox when run on this very page in stackoverflow:
