gpr_elements_to_shuffle

  1. Description
  2. Usage
  3. Parameters
  4. Example
    1. Make First Choice Sticky
  5. Since

Description

Filter the individual elements to be shuffled inside a field. Useful for excluding certain choices from being shuffled.

Usage

window.gform.addFilter( 'gpr_elements_to_shuffle', 'my_custom_function' );

Parameters

  • $elsToShuffle JQuery

    The jQuery elements to be shuffled.

  • formId int

    The current form ID.

  • fieldId int

    The current field ID.

Example

Make First Choice Sticky

Exclude the first choices in all fields in a form from being shuffled.

window.gform.addFilter(
	'gpr_elements_to_shuffle',
	function ($elsToShuffle, formId, fieldId) {
		if (formId != GFFORMID) {
			return $elsToShuffle;
		}

		/* Exclude randomizing the first choice in every field in the current form. */
		return $elsToShuffle.slice(1);
	}
);

Since

This filter is available since Gravity Forms Randomizer 1.0.5.