KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In my code I split a string based on _ and grab the second item in the array. var element = $(this).attr('class'); var field = element.split('_')[1]; Takes good_luck and provides me with luck . Works great! But, now I have a class that looks like good_luck_buddy . How do I get my javascript to ignore the second _ and give me luck_buddy ? I found this var field = element.split(new char [] {'_'}, 2); in a c# stackoverflow answer but it doesn't work. I tried it over at jsFiddle...
Tags (comma-separated)
Save Edits
Cancel