I have a form field survey question with seven fields, and I need only the last field to be displayed as currency. It seems like cleave.js is a great option for this; I have tested it out and it works great. However, it's showing up only on the first field in the form field question, and I need it to only be on the last one.
I know I need to refer to the specific field somehow but I'm still new to JavaScript so I'm not sure what to do.
Below is what I have added to the JavaScript of the question:
new Cleave('.InputText', {
numeral: true,
prefix: '$'
});
What do I need to add or change so that it is only used on the last field of the form question?
Solved
Using Cleave.js in One Field of a Form Field
Best answer by TomG
Try this:
var lastInput = jQuery("#"+this.questionId+" .InputText:last").get(0);
new Cleave(lastInput, {
numeral: true,
prefix: '$'
});
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
