jquery check validity of single element

jquery, validation

Solution

You can use

$('#numField')[0].validity.valid

I know this is old question but maybe it will be useful for someone.

Problem

I have a number input field and I'm trying to use jquery to check if the value in there is valid. I can do it in standard javascript/html5 using ``` // html <input type="number" id="numField" min="50"/> // javascript document.getElementById('numField').validity.valid ``` And this works. With jquery, I've seen how to validate a whole form, but this element is not inside a form (its value is just retrieved as part of an ajax method). Is there a jquery equivalent of the validity check?

Original source