Skip to content

Instantly share code, notes, and snippets.

@gerasimua
Created November 14, 2015 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gerasimua/1573783b5af32a1d0c70 to your computer and use it in GitHub Desktop.
Save gerasimua/1573783b5af32a1d0c70 to your computer and use it in GitHub Desktop.
CVV
$body.on('input', '#cvv', function(){
$('#cvv-fake').val(new Array(this.value.length + 1).join('*'));
});
<div class="form-group relative">
<label for="cvv" class="sr-only">CVV</label>
<input type="cvv" id="cvv-fake" class="form-control" name="cvv"
autocomplete="off" placeholder="CVV" title="Card CVV (XXX)"
maxlength="3" value="" tabindex="-1"/>
<input data-bind="value: cvv" type="cvv" id="cvv" class="form-control" name="cvv"
autocomplete="off" placeholder="CVV" title="Card CVV (XXX)"
required pattern="\d{3}" maxlength="3" value=""/>
</div>
input#cvv{
position: absolute;
top: 0;
opacity: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment