jquery-validation
jquery-validation copied to clipboard
Attach jquery within onRendered don't work
I try, but some time don't work.
Can't find $( "#example-form" ) (maybe attach before rendered).
Template.exampleForm.onRendered( function() {
$( "#example-form" ).validate();
});
And then
Template.exampleForm.onRendered( function() {
Meteor.setTimeout(function () {
$( "#example-form" ).validate();
}, 1000);
});
I have many for this problem of attachment jquery. Please help me.
@thearabbit can you share your template HTML/markup? If you have any loading state in your template, it's possible that it's blocking the rendering of the form meaning that jQuery Validation cannot attach to it.
thanks for your reply.
oh sometime I use jquery Block UI, to block until the method got the result from server (use it in onCreated).
It have problem or not?
@thearabbit yes, this would cause a problem sometimes. If the <form></form> element having validation attached to it isn't visible in the DOM when your onRendered() function fires, then the validation won't work. If you can, pull the <form></form> element outside of your Block UI code so it's always visible (but its contents still show/hide based on your Block UI code).