Rafael
Rafael

Reputation: 11

How to remove a set of first 3 characters in an input field, after user is done typing - with jQuery

Is there any way I can remove a match of a set of first 3 characters in an input field, once a user is done typing, with jQuery?

Upvotes: 0

Views: 230

Answers (1)

Premshankar Tiwari
Premshankar Tiwari

Reputation: 3106

If you want to remove first three characters after user has moved his cursor to other field, use this code...

$('#yourInputField').blur(function(event) {
    field = event.target;
    value = field.value;
    $('#yourInputField').val(value.substring(3,value.length));
});

Upvotes: 2

Related Questions