Clear all fields after record inserted in asp.net
I have a small form of 4 fields, I am using Ajax to save record and give alert to user on same page. all is working fine but I want to clear all 4 fields after record is inserted and don't want user to press again and duplicate,
Right now I am using
开发者_运维技巧this._studentName.text = "";
but is there any easy method to get same result coz I have another form where there are more then 40 fields and don't want write .text = "" 40 times
If you use jQuery then you could write:
$('#formID input[type=text]').val('');
If you don't use jQuery then you could still call this.getElementsByTagName('input')
and loop through the results to clear the values.
If it's applicable, Why not redirect to the same page? :)
精彩评论