Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove first character with jQuery

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]]);
like image 696
sephiith Avatar asked May 23 '13 02:05

sephiith


1 Answers

No need to use jQuery for that, just plain ol' javascript using .substring

var trimmed = this.className.substring(1);
like image 75
Benjamin Gruenbaum Avatar answered Oct 12 '22 23:10

Benjamin Gruenbaum