Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get first value from the word entered in the input (only first letter)

Tags:

jquery

text

input

I know that this question is so noob . but I want to know that how to get the first letter from the entered word in an input text.

I don't know about it .but please guide me about that .

like image 742
janatan Avatar asked Jun 13 '13 06:06

janatan


1 Answers

The native Javascript substr() method can do that:

var firstChar = $('#textbox').val().substr(0, 1);

The first argument is the character position to start from, the second is the length to take.

MDN Docs

like image 200
MrCode Avatar answered Sep 28 '22 04:09

MrCode