How to delete last character from a string for instance in 123-4- when I delete 4 it should display 123- using jQuery
123-4-
4
123-
You can do it with plain JavaScript:
alert('123-4-'.substr(0, 4)); // outputs "123-"
This returns the first four characters of your string (adjust 4 to suit your needs).