[jQuery] Resetting a form/general floundering
<html>
<body>
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...
<tt>
$("img.togAQs").click(function(){$("nLinkForm").reset();$("#aqs").slideDown("slow");});
</tt>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
<tt>$("nLinkForm")[0].reset(); </tt>to no benefit. Now,
after trying <tt>$("#sQuestion").html('abc'); </tt>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
</body>
</html>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/