Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I cut the 1st char from a string in jquery?

Does anyone know how can I cut the 1st char from the string in jquery?

Example: If I have string as following:

var test = '3265';

How can I cut only the 1st char so that the output will be '3' instead?

like image 514
Jin Yong Avatar asked Dec 04 '22 22:12

Jin Yong


1 Answers

Why jQuery?? Just use plain old javascript:

var first = test.substring(0, 1)
like image 109
Marek Karbarz Avatar answered Dec 28 '22 03:12

Marek Karbarz