jQuery : how to manipulate indexes?
- by Gabriel Theron
Should not be such a hard question... I'm just having a hard time figuring out how to make operations on some jquery elements, particularly their indexes. Teh codez:
$( "#docSlider" ).css("background-image", "url(../../bundles/mypath/images/maquette/img" + $( "#selectable li" ).index( this ) + (".jpg)"));
I want to make the name of the picture I load depend on the index of a jQuery selectable. So I grab the index and try to add 1... but it can't work because "+" is also a concatenator.
I've tried to parseInt as well, but it was always worth 0.
How do I simply transform the index to an integer and then concatenate it with the rest of the string?
Thank you in advance!
Edit : I'm using a function that already exists, so I can hardly change the parameters (well, I guess I can't...)