I want to reset the value of this form which sends an AJAX request to the server:
<form accept-charset="UTF-8" action="/showable_videos" class="new_showable_video" id="new_showable_video" method="post"><div style="margin:0;padding:0;display:inline">
<input name="utf8" type="hidden" value="✓">
<input name="authenticity_token" type="hidden" value="+hPWXwRBfAfz5lCKJRM3QouBzsYuje+wgGKb2OAH7Z4="></div>
<input id="video_id_field" name="showable_video[video_id]" type="hidden" value="506">
<input class="showable_field ui-autocomplete-input" id="showable_video_profile" name="showable_video[profile]" size="30" type="text" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true">
</form>
I tried $('form开发者_JAVA技巧#new_showable_video')[0].reset();
but it doesn't seem to work, possibly because a user selects an element from an autocomplete list, and upon selection the AJAX request is sent.
Answer here : Resetting a multi-stage form with jQuery
精彩评论