Character count fails if ID starts with a number. #2058
Labels
🐛 bug
Something isn't working the way it should (including incorrect wording in documentation)
character count
🕔 hours
A well understood issue which we expect to take less than a day to resolve.
Description of the issue
When character count is used on a textarea with
id
which start with a number, it fails with an exception:Steps to reproduce the issue
Having a textarea with
id
which start with a number:Current behaviour
querySelector
in character-count.js crashes whenid
starts with a number:govuk-frontend/src/govuk/components/character-count/character-count.js
Lines 8 to 10 in 9b320ce
(This is a minimal reproduction of the issue)
The reason for the crash is that
id
selector is not being quoted.Expected behaviour
querySelector
works whenid
starts with a number:It works when
id
selector is quoted:id="1_details-info"
.The text was updated successfully, but these errors were encountered: