Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Allow jQuery Validate to mark Chosen select box as valid
# Allow jQuery Validate to run validation on jQuery Chosen
# select boxes by changing the ignore selector from `:hidden`
$.validator.setDefaults
ignore: '.no-validate'
# jQuery Validate doesn't mark fields as valid on hidden elements
# So when using Chosen we need to show the original input,
# give it focus and then hide it again
$('.js-chosen-select').on 'change', ->
$(this).show().css
'position' : 'absolute'
'left': '-9999px'
'opacity' : '0'
.focus()
.attr('style','')
.hide()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.