JQuery

How to pick last character using jquery?

How to pick last character using jquery?, someone asked me to explain?

This article describes you to pick the last character using jquery. If someone inputs the textbox . From that input you want to pick the last character. You can get it by simply using jquery. Byusing slice keyword you can pick the last character. Here for example.

 Input:

infinetsoft.com

 

$(function () {

 
        $("#txtName").change(function () {

            var title = $('#txtName’).val();

            var lastChar = title.slice(-1);

            alert(lastChar);

        });

});

  

Output:

infinetsoft.co

Post your comments / questions