Reputation: 1197
How would I go about removing the first character from this.className in the below line? The first variable will be _ and then a number. I just want the number to be assigned to className.
className = this.className;
Furthermore I am changing "$('.inter').html(window[link[className]]);"
to use an array instead of the className variable. Is the below code the correct way to use an array with the index as a variable?
$('.inter').html(window[link[className]]);
Upvotes: 20
Views: 72607
Reputation: 276306
No need to use jQuery for that, just plain ol' javascript using .substring
var trimmed = this.className.substring(1);
Upvotes: 83