In this tutorial, learn how to remove first character from the string on button click using jQuery. The short answer is to usesubstring() or slice() to remove the first letter from the string.

The tutorial removes only the first character from the string. You have to pass 1 as the argument of the function to remove the first letter of string with jQuery.

jQuery Substring() to Remove First Character

To remove the first letter from the string, you can use jQuery substring(). You have to first use the jQuery text() to get the text content. After that, you have to use the substring first to remove the first letter of string.

Output

&This is my string

The above example contains the ‘&’ symbol as the first character. Click the above button to remove the ‘&’ letter from the string. You will get the string without the first letter of the string.

Remove First Character Using Slice()

In addition to the above example, you can remove the first letter using slice(). This works same as substring() and removes the first letter of the string.

Output

&This is my string

Click the above-given button to remove the first letter of the string. This gives you the same string as you got with the substring() of jQuery.

You may also like to read.

Hope, you like this tutorial on how to remove the first letter from the string using jQuery. If you have any query regarding the tutorial, please comment below.

Also tell me, which method you are using to remove the first letter from a string using jQuery.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.