jeudi 7 mai 2020

How regular expression g parameter for do only one spaces between keywords?

Yes, I couldn't. As for the two space characters, I want to remove one. Should we do this with the g parameter? What does it do?

$(".inputonlytext").on("keyup", function() {
    var regexp = /[^a-zA-Z ]*$/g; //For Only Text
    if ($(this).val().match(regexp)) {
        $(this).val($(this).val().replace(regexp, ''));
    }
});

Aucun commentaire:

Enregistrer un commentaire