Skip to content
Amal Hashim
All posts
Snippet

jQuery Split String

Split a string on a delimiter using the built-in JavaScript split function.

1 min read#JavaScript#jQuery

jQuery has no split function of its own. Use the one built into JavaScript strings.

js
var split = 'john smith#5551234567'.split('#');

var name = split[0];   // john smith
var mobile = split[1]; // 5551234567