javascript - jquery .addClass to future js generated html -
i this:
$(".field-validation-error").addclass('ui-state-error');
and @ moment happens
$("body").prepend("<span class="field-validation-error">this field required.</span>")
i new added element have class 'ui-state-error'
you can either add yourself, changing .prepend()
call, or use the .livequery()
plugin, this:
$(".field-validation-error").livequery(function() { $(this).addclass('ui-state-error'); });
this execute bounds .field-validation-error
elements, , future ones. or, if changing stylesheet option, include both selectors:
.field-validation-error, .ui-state-error { ....styles.... }
Comments
Post a Comment