jeudi 13 juillet 2017

character/string/word restriction - javascrtip or typscript or jquery

looking out help for below simple one

what am having is

<input type="checkbox" name="chkbxr" value="add this offer on wrapper" 
 (change)="addthisTxt($event.target.getAttribute('txt'), $event.target.checked)">

addthisTxt(txt, checked): void {
    if (checked) {
        if(this.v.offerName.length >= 55){
            this.v.offerName = this.v.offerName + txt;
        }
        this.v.offerName = this.v.offerName;

    }
}

the problem is it's not checking the length. it should not exceed 11 above code is what i tried so far. clearly i want to keep on add text until it reaches it max length otherwise it should restrict the user to add

thanks for the help




Aucun commentaire:

Enregistrer un commentaire