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

Focus & keyup events not firing when input type is missing #217

Closed
jgritman opened this issue Oct 4, 2011 · 6 comments
Closed

Focus & keyup events not firing when input type is missing #217

jgritman opened this issue Oct 4, 2011 · 6 comments

Comments

@jgritman
Copy link

jgritman commented Oct 4, 2011

I have a few <input> tags in my app that don't have an explicit type set, but they render as type of text by default. After upgrading 1.8.1 to 1.9pre, these fields no longer trigger validations for keyup or focus events.

This looks to be due to commit 5ba0df4 where the :text selector was replaced with [type='text'] on line 319.

@okyanet
Copy link

okyanet commented Oct 20, 2011

I've noticed this issue, in my case not due to missing type but because I'm using HTML5 input types:

type="email"
type="tel"
type="url"

etc

It seems to validate on form submission but doesn't work on the keyup/focus events. Any idea if this can be fixed easily by updating the plugin code?

@reduxionist
Copy link

bump This issue caused me a couple hours of debugging in my first attempt to use this plugin. Great plugin though.

@outis
Copy link

outis commented Apr 9, 2012

Adding input:not([type]) to the selector fixes the original issue. Note that the original selector wouldn't have worked for non-standard types, so lucasmodx is facing a different issue.

outis added a commit to outis/jquery-validation that referenced this issue Apr 9, 2012
@jzaefferer
Copy link
Collaborator

jQuery doesn't support matching input's without a type attribut with the [type=text] filter, and doesn't plan to fix that. Even if this plugin would work around that, there's still a good chance that something else breaks due to the missing attribute. I'd rather force people to always add type="text" to their markup.

@mlynch any thoughts here?

@mlynch
Copy link
Contributor

mlynch commented Apr 9, 2012

@jzaefferer from this jQuery bug it seems an empty text attribute is okay to use (defaults to "text") and is supported by the :text pseudo selector. From that bug it seems validate should support it.

@jzaefferer
Copy link
Collaborator

In this context, the performance overhead of a custom selector (not going through qSA) should be fine. And is probably more effective then doing input:not([type]).

mlynch added a commit to mlynch/jquery-validation that referenced this issue Apr 11, 2012
…empty type attribute. Added tests and some test markup. Fixes jquery-validation#217
@mlynch mlynch closed this as completed in a436634 Apr 17, 2012
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

No branches or pull requests

6 participants