Skip Navigation

[Resolved] Assign element id to generic field

This support ticket is created 5 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 5 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#1297011

Dear Sir/Madam,

I add a generic field, I want to have custom javascript to manage this, I find the element id is changed very time, is it possible to assign an element id to the generic field?

#1297035

There's no way to apply a static ID, but you can use the "class" attribute to apply a custom CSS class or you can use the CSS name attribute selector to target the field.

[cred_generic_field type='select' field='some-generic-field-slug' class='some-static-css-class']
...
[/cred_generic_field]

JavaScript selectors:

var input = jQuery('.some-static-css-class').first()
// or
var input = jQuery('input[name="some-generic-field-slug"]').first()