$("#sEmail").get(0).reset();
should work. reset() is not a chainable method of jquery.

-Ashutosh

On 8/22/06, Bruce MacKay < [EMAIL PROTECTED]> wrote:
Thanks for the responses Kenton,Matt.  I've only been partially successful however in progressing these solutions.

I have tried your solutions: The .val is partially successful in that it erases a form element's content, but only by inserting a blank space in its place  (e.g. $("#sComment").val(" ");).

The ID of my form is 'commentsFormZ' but I cannot get the .reset() option to fire at all.  

What am I doing wrong?

My code (with the various attempts) is:

$.fn.ajaxSubmit = function(e) {this.submit(function(){ var params = {}; $(this) .find("[EMAIL PROTECTED], [EMAIL PROTECTED]'text'], [EMAIL PROTECTED]'hidden'], [EMAIL PROTECTED]'password'], [EMAIL PROTECTED], textarea") .filter(":enabled") .each(function() { params[ this.name || this.id || this.parentNode.name || this.parentNode.id ] = this.value; });$("div#indicate").show();$("div#comments3").hide(); $.post(this.getAttribute("action"), params, function(text){
            $("div#indicate").hide();

        $("div#comments2").html(text).fadeIn("slow");
        $("commentsFormZ").reset();
        $("#sComment").val(" ");
        $("#sEmail").reset();

        $('#hilightcomment').highlightFade({color:'yellow',speed:2000,iterator:'linear'})
        }); return false; });}


At 12:46 p.m. 21/08/2006, you wrote:
Or do $("formElement").reset();

, that would reset the form to its original state.

On 8/20/06, Bruce MacKay < [EMAIL PROTECTED]> wrote:
Hi folks,

I use the function below to send user comments to a database and get refreshed on the current page - no problems.

However, I cannot seem to "erase" the contents of the comments form (id=NewCommentZ) for subsequent use - the text area and text input elements remain populated with the previously entered content.

The disabled lines in the code below are my guesses - no more - of how to erase the form's contents, but I wasn't lucky.

I'd appreciate someone providing me with some direction/hint towards a solution.

Thanks,

Bruce



$.fn.ajaxSubmit = function(e) {this.submit(function(){ var params = {}; $(this) .find("[EMAIL PROTECTED], [EMAIL PROTECTED]'text'], [EMAIL PROTECTED]'hidden'], [EMAIL PROTECTED]'password'], [EMAIL PROTECTED], textarea") .filter(":enabled") .each(function() { params[ this.name || this.id || this.parentNode.name || this.parentNode.id ] = this.value; }); toggleContent('NewCommentZ');$.post(this.getAttribute("action"), params, function(text){
        $("div#comments2").html(text).fadeIn("slow");
        $('#hilightcomment').highlightFade({color:'yellow',speed:2000,iterator:'linear'})
        //$("NewCommentZ").html("");
        //$(this).find("[EMAIL PROTECTED], [EMAIL PROTECTED]'text'], [EMAIL PROTECTED]'hidden'], [EMAIL PROTECTED]'password'], [EMAIL PROTECTED], textarea").html("");
        }); return false; });}

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



Bruce R MacKay
College of Sciences
PN 452
Massey University
Private Bag 11222
Palmerston North
New Zealand

p ++64 6 3504423
f ++64 6 3505610


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/





--
Reach1to1 Communications
http://www.reach1to1.com
[EMAIL PROTECTED]
98201-94408
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to