30
rated 0 times
[
34]
[
4]
/ answers: 1 / hits: 8817
/ 11 Years ago, tue, january 7, 2014, 12:00:00
I have a div that I need to strip away all characters except for the last four. I'm currently using replaceWith for this, but it replaces the whole thing.
Here's what I have
<div class=field-name-field-credit-card>1111111111111111</div>
$(.field-name-field-credit-card).replaceWith(xxxx xxxx xxxx xxxx);
and my result
<div class=field-name-field-credit-card>xxxx xxxx xxxx xxxx</div>
But I would like it to be:
<div class=field-name-field-credit-card>xxxx xxxx xxxx 1111</div>
More From » jquery