PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

jQuery: Get Field Names/Labels

  1. etrakdev
    Member

    Is there a way to get to the field name mapping with a jQuery or Javascript call?

    Currently, all fields appearing in a form are using "input" or "field" and the form and field number only. What would be great if I could manipulate the field values via jQuery or Javascript other than to having to refer to them by the current ID or field name. There are some use cases for this, which I can supply if requested. I first wanted to see if this has been already demonstrated as a possible practice.

    Thanks,

    JB

    Posted 12 years ago on Friday April 27, 2012 | Permalink
  2. kyle
    Member

    It's not pretty, but you could do something like:

    jQuery(".gform_wrapper li label:contains(Date)").parent("li").find("input[type='text']").css("color", "red");

    To find a label with the text Date, then finding the next text input field and style the text so the colour is red. You might want to create a custom selector in jQuery though.

    Posted 12 years ago on Friday April 27, 2012 | Permalink