Using jQuery to control form elements
jQuery is a versatile method used to alter any HTML page. In CiviCRM, we can use it to accomplish tasks that are impossible using custom templates or CSS. A common problem is how to expose different price sets on an event registration form.
Getting ready
In this example we have a membership organization called Inner City Arts. We have enabled the CiviMember Roles Sync module. This module synchronizes membership status to a Drupal role. In this case, if an individual is a current member of Inner City Arts, CiviMember Role Sync automatically assigns them the role of Member in Drupal. This means that when a member logs in, we can tell that they are a member of Inner City Arts because they have the Member role in Drupal.
If you want to play around with jQuery and see how the components work, you can use Firefox as your browser and install the Firebug extension, or use Google Chrome.
How to do it…
In this recipe, we will use jQuery to show different price sets...