For instance, if my price field is called Main Conference (Before 7/31), the CSS class it gets is: "main_conference_before_7_31_-content"

If I change the title of the price set, the CSS class changes.

When modifying the form with jQuery, we rely on the CSS class to make adjustments like .prependTo (etc.). Perhaps this is not the most ideal way to do it, but it's worked in a pinch.

How difficult would it be to make an extension to make the price set field class fixed, or even user-adjustable? Or, to set a class and ID for each one?

Civi 4.7 or 5.x


CiviCRM uses civicrm_price_set.name to generate class. I believe this field in never updated on Update mode. It is updated when we explicitly set them using api or mysql query.

  • I tested it on 5.6.alpha1 and it does not change now.
    – Zachary
    Aug 4 '18 at 18:23

I'm not sure how much the price fields name will change but perhaps you can use some 'wildcard' attribute selectors? (contains, starts with etc.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.