I'm trying to mask an output that was forwarded from the form i made but doesn't seems to work .
input field from page 1
<form method="post" action="step2.php" id="form1" name="form1">
Enter Card Here:<input name="card" type="text" id="card"
value="<?php echo $_POST["card"]; ?>" style="width:85px;"
class="validate[custom[card]] text-input" /> </form>
this is the code i'm using
<script> var card = "<?php echo $_POST["card"]; ?>"; var str = "";
for(var i=1; i <= card.length-4; i++) { str += "*"; }
ecard = str + card.substr(card.length-4);
$('.ccard').appendTo('ecard'); </script>
this is where the output should appear
<label class="ccard"></label>
on the input field the user must input 12 digit number
ex: 123456789012
then it should appear as
********9012
the first 8 digits are masked and only the last 4 digits are visible.