How to remove first character from string jquery Example?

Today, We want to share with you remove first character from string jquery.In this post we will show you jquery delete character from string, hear for substring jquery we will give you demo and example for implement.In this post, we will learn about javascript string slice with an example.

Remove First Character From the String Using jQuery

You can use the JavaScript simple substring() method to remove/delete first character form a string Examples.

Read Also:  jQuery Ajax Delete Request with Laravel

How to remove first 3 letters in JQuery?

Example 1:

//No jQuery needed.
"pakainfo9898".slice(3);

//
"pakainfo9898".substring(3);

Example

var str="pakainfo9898";
console.log("using slice =",str.slice(3));
console.log("using substring =",str.substring(3));
console.log("using substr =",str.substr(3));

Use the JavaScript substring() method

index.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Delete first Character from String - www.pakainfo.com</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
$(document).ready(function(){
    $("a").click(function(){
        var getproductID = $(this).attr("href");
        var productId = getproductID.substring(1, getproductID.length);
        alert("The ID of the linked product image is - " + productId);
    });
});
</script>
</head>
<body>
    <a href="#products">Show Products</a>
    <br>
    <img src="products.jpg" style="margin-top: 800px" alt="All Main New Air Products" id="products">
</body>
</html>

I hope you get an idea about trim in jquery.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.