Sha256: 19c76f1d0068d8f21713920f307d8532740ded75820fa57d4de893b9359b05c0
Contents?: true
Size: 1015 Bytes
Versions: 277
Compression:
Stored size: 1015 Bytes
Contents
window.GOVUK = window.GOVUK || {} window.GOVUK.Modules = window.GOVUK.Modules || {}; (function (Modules) { function ContextualGuidance ($module) { this.$module = $module this.$guidance = this.$module.querySelector('.gem-c-contextual-guidance__wrapper') this.$inputId = this.$guidance.getAttribute('for') this.$input = this.$module.querySelector('#' + this.$inputId) } ContextualGuidance.prototype.init = function () { if (!this.$input) return this.$input.addEventListener('focus', this.handleFocus.bind(this)) } ContextualGuidance.prototype.handleFocus = function (event) { this.hideAllGuidance() this.$guidance.style.display = 'block' } ContextualGuidance.prototype.hideAllGuidance = function () { var $guidances = document.querySelectorAll('.gem-c-contextual-guidance__wrapper') for (var i = 0; i < $guidances.length; i++) { $guidances[i].style.display = 'none' } } Modules.ContextualGuidance = ContextualGuidance })(window.GOVUK.Modules)
Version data entries
277 entries across 277 versions & 1 rubygems