I am trying to:
The title says it!
Hey there,
i followed this to do a character limit on fields but it does not work for me:
https://toolset.com/forums/topic/limit-character-count-om-a-cred-field/
how do i have to address the cred fields right?
Hi Steffen,
Thank you for contacting us and I'll be happy to assist.
Can you please share temporary admin login details, so that I can log in and see the form and the custom script that you've added?
I've set your next reply as private so that only you and our support team will have access to it.
Please share the link to the page where the form and custom script can be viewed.
Important note: Please make a complete backup of the website, before sharing the access details.
regards,
Waqar
Hey Waqar,
like you know you can´t give a cred form field an id= attribute.
So i just want to know how i can use a field in a form as an id for jquery.
Lets have this code example:
[php]
$("'HERESHOULD_BE_THE_POST-FIELD_OR_CUSTOM-FIELDS_SELECTOR").on("click", function(){
$(this).hide();
});
How can i address the formfields ID
cheers
Hi Steffen,
Thanks for writing back.
Your understanding is correct and the "cred_field" shortcode doesn't accept an "id" attribute.
( ref: https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field )
But, there are a number of ways through which you can target a specific field through jQuery:
1. You can use the class attribute, to include a special unique class to the field, e.g.
[cred_field field="post_title" class="form-control special-field-1" output="bootstrap"]
You'll be able to select that field in a jQuery script like this:
$(".special-field-1").on("click", function(){
$(this).hide();
});
OR
2. You can also add a specific "id" to the wrapper of the field that you'd like to target, e.g.:
<div class="form-group" id="special-field-1">
<label>Title</label>
[cred_field field="post_title" class="form-control" output="bootstrap"]
</div>
And then target it through jQuery code like this:
$("#special-field-1 input").on("click", function(){
$(this).hide();
});
You'll find more useful information on jQuery selectors at:
hidden link
I hope this helps.
regards,
Waqar
My issue is resolved now. Thank you!