user1220022
user1220022

Reputation: 12105

jQuery select ID from comma separated list

Is there a simple one liner I can use to select the nth element from a comma separated list in jQuery?

For example if I have: var eg = "a,b,c,d";

How can I select element c?

Upvotes: 0

Views: 1235

Answers (1)

Kyle
Kyle

Reputation: 22268

var eg = "a,b,c,d";
eg.split(",")[2];

Upvotes: 5

Related Questions