Hello folks,
Please excuse this longish post but I'm seriously confused.
I'm building a quiz editor. I have form (#nLinkForm) which is loaded
with the page and a submit function bound to it.
Once the user has selected the type of quiz, an appropriate set of
input elements (text, textarea, checkbox) is loaded into a div (#aqs)
within "nLinkForm" via an AJAX call. The questions/answers entered
into these elements are correctly send to the server when the form is
submitted.
My problem occurs next - I want to reset the form to clear all the
contents of the input elements in readiness for another set of
question/answers to be entered.
I have an image tag set up with the following code...
$("img.togAQs").click(function(){$("nLinkForm").reset();$("#aqs").slideDown("slow");});
which I had hoped would clear the contents of the text/textarea etc
elements of the form - it doesn't and hence this call for help. What
am I doing wrong? A workaround is to load a blank "template" via
another ajax call, but I was hoping to "clear the decks" client-side.
I know the function as a whole is being fired as evidenced by the
contents of the "aqs" div becoming visible/sliding down.
After reading the archives, I also tried $("nLinkForm")[0].reset();
to no benefit. Now, after trying $("#sQuestion").html('abc'); as a
check to change the contents of one of the text input elements, I'm
now thinking that jquery cannot "see" the form elements within #aqs.
Is this the correct interpretation of what's happening/not
happening? If so, how do I ensure that jquery does recognise
elements introduced into a page via an AJAX call?
Thanks,
Bruce
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/