javascripts/govuk/show-hide-content.js
function init ($container, elementSelector, eventSelectors, handler) {
      $container = $container || $(document.body)

      // Handle control clicks
      function deferred () {
        var $control = $(this)
        handler($control, getToggledContent($control))
      }

      // Prepare ARIA attributes
      var $controls = $(elementSelector)
      $controls.each(initToggledContent)

      // Handle events
      $.each(eventSelectors, function (idx, eventSelector) {
        $container.on('click.' + selectors.namespace, eventSelector, deferred)
      })

      // Any already :checked on init?
      if ($controls.is(':checked')) {
        $controls.filter(':checked').each(deferred)
      }
    }
function init ($container, elementSelector, eventSelectors, handler) {
      $container = $container || $(document.body)

      // Handle control clicks
      function deferred () {
        var $control = $(this)
        handler($control, getToggledContent($control))
      }

      // Prepare ARIA attributes
      var $controls = $(elementSelector)
      $controls.each(initToggledContent)

      // Handle events
      $.each(eventSelectors, function (idx, eventSelector) {
        $container.on('click.' + selectors.namespace, eventSelector, deferred)
      })

      // Any already :checked on init?
      if ($controls.is(':checked')) {
        $controls.filter(':checked').each(deferred)
      }
    }
function init ( $container , elementSelector , eventSelectors , handler ) { $container = $container || $ ( document . body ) // Handle control clicks function deferred ( ) { var $control = $ ( this ) handler ( $control , getToggledContent ( $control ) ) } // Prepare ARIA attributes var $controls = $ ( elementSelector ) $controls . each ( initToggledContent ) // Handle events $ . each ( eventSelectors , function ( idx , eventSelector ) { $container . on ( 'click.' + selectors . namespace , eventSelector , deferred ) } ) // Any already :checked on init? if ( $controls . is ( ':checked' ) ) { $controls . filter ( ':checked' ) . each ( deferred ) } }
Set up event handlers etc
Set up event handlers etc