Skip to content

Commit

Permalink
Refactor out redundant character counter code
Browse files Browse the repository at this point in the history
  • Loading branch information
querkmachine committed Mar 22, 2022
1 parent 312b1f0 commit cd61600
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/govuk/components/character-count/character-count.js
Expand Up @@ -5,9 +5,7 @@ import '../../vendor/polyfills/Element/prototype/classList'
function CharacterCount ($module) {
this.$module = $module
this.$textarea = $module.querySelector('.govuk-js-character-count')
if (this.$textarea) {
this.$fallbackLimitMessage = document.getElementById(this.$textarea.id + '-info')
}
this.$countMessage = null
}

CharacterCount.prototype.defaults = {
Expand All @@ -20,7 +18,7 @@ CharacterCount.prototype.init = function () {
// Check for module
var $module = this.$module
var $textarea = this.$textarea
var $fallbackLimitMessage = this.$fallbackLimitMessage
var $fallbackLimitMessage = document.getElementById(this.$textarea.id + '-info')

if (!$textarea) {
return
Expand Down

0 comments on commit cd61600

Please sign in to comment.