Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing issue for attributes with dot #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dondurivan
Copy link

Adding single quotes fixes the error when there is dot in attribute.

In my case:
for=flat.flat was returning Uncaught Error: Syntax error, unrecognized expression: [for=flat.flat]

Adding quotes fixed it.

@rtelicak
Copy link

Hi,

I have similar problem, but there are many more special characters which cause selector not to work properly, like
, : [
see jquery selectors docs right at the beginning

so I'd go with escaping selector first, then use it as usually

// escape possible special characters in selector
elLabelId = elLabelId.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~]/g, '\\$&')

tried it with

<input id="[a." type="checkbox">
<input id="a.b." type="checkbox">
<input id="asd!*" type="checkbox">
<input id="!@##$%^%&^&*)" type="checkbox">

and worked well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants