Check Input Size and display label according to expression

Asked

Viewed 139 times

1

I have a function that checks if a field is less than 3 when focusing (clicking) on the input Email.

In short:

If CPF and RG is less than 3, displays the label[for="label-custom-field2"] and label[for="label-custom-field3

If Only RG is less than 3, displays the label[for="label-custom-field3"] and hides thelabel[for="label-custom-field2.

If Only CPF is less than 3, displays the label[for="label-custom-field2"] and hides thelabel[for="label-custom-field3.

However, even if the ID is filled when focusing on the email field, the label[for="label-custom-field3 is displayed.

See the code here.

  • I find that kind of thing easier to do with Angular :D

  • @Angular wallacemaxters would be easier?

1 answer

0


How about something like this example?

You can return false in the function and display what you want according to some parameter of the date-type of the text field.

Try to follow this article that can facilitate.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.