[jQuery] quick question about loading in form elements using load()
Hi, hope everyone is well...
my problem is simple, i am using load() to add an external file form
contents to the dom. normally i have a listener for form elements
such as inputs and textareas in my $(function() { }) that adds a
class to inputs on focus and removes it on blur...
but it doesnt work on the form that is load() 'ed in unless i have the
script embedded in the html that is load()'ed
i can live with this but i am curious if anyone knows the proper way
where i can keep my javascript separate from the html?
thanks and for the curious out there here is the code:
[code]
jQuery(function() {
// pretty up the form elements on focus
jQuery('input').focus(function() {
jQuery(this).addClass('focus');
}).blur(function() {
jQuery(this).removeClass('focus');
});
jQuery('textarea').focus(function() {
jQuery(this).addClass('focus');
}).blur(function() {
jQuery(this).removeClass('focus');
});
});
[/code]