Hi there,
i am using the excerpt field in a form, and I would like to limit it to 200 caracters. How can I do this?
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Jutta,
Can you let me know if this is a single line field or a WYSIWYG field ?
Thanks,
Shane
Hi Shane something in between 🙂 It looks like a field with several lines, but no WYSIWYG.
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Jutta,
Thank you for the clarity.
You should be able to do this by using the jQuery in below.
hidden link
Now ensure that you replace all the '$' with the text 'jQuery'
This code can be added to the JS section of your form.
Please let me know if there are any issues.
Thanks,
Shane
Hi Shane,
thanks for your help. Unfortunately it does not work.
I have added this to the JS section:
var maxchars = 200;
jQuery('textarea').keyup(function () {
var tlength = jQuery(this).val().length;
jQuery(this).val(jQuery(this).val().substring(0, maxchars));
var tlength = jQuery(this).val().length;
remain = maxchars - parseInt(tlength);
jQuery('#remain').text(remain);
});
(where does this code know from which field I want to limit?)
Regards
Jutta
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Jutta,
The code targets the specific field with the statement "jQuery('textarea')"
However to get the actual field name I will need to look at the page that has the form. Would you mind allowing me to have access to the page so that I can have a look at the form.
Thanks,
Shane