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

Popular posts from this blog

silverlight - Applying a style to ItemContainerStyle in C# -

c# - NullReferenceException in MySqlClient.NativeDriver -

php - Updating recent updates - Problem in procedure - Any other approach? -