Search code examples
javascriptjquerynumericmasking

How to apply masking to numeric field with a trailing character


I have a numeric(15,2) field. I want to apply masking to it with a trailing character.

Let's say

var x = 789.98;

output :

789.98x

How can I do this?

Thanks in Advance


Solution

  • Did you really mean to just add a character?

    var x = number + 'x';
    

    If you meant to mask the last one you can do

    var x = number.substring(0, number.length - 1) + 'x';