开发者

how do I use jquery to clear the input in a form?

开发者 https://www.devze.com 2023-02-28 05:06 出处:网络
Here is the haml fo开发者_开发技巧r my form: 34 #new_comment 35%strong Add Comment: 36- semantic_form_for \'comment\', :url => add_comment_url(@review), :remote => true do |f|

Here is the haml fo开发者_开发技巧r my form:

 34 #new_comment
 35   %strong Add Comment:
 36   - semantic_form_for 'comment', :url => add_comment_url(@review), :remote => true do |f|
 37     
 38     = f.text_area :comment, :label => :comment, :cols => 60,:rows => 5, :input_html => {:rows => 5, :cols => 30}
 39     = f.submit

After I submit, I have jquery javascript in a .js.erb file, but I can't get it to clear. this is what I have:

  7 /* Reset the comment form */
  8 $("#comment_comment").reset();

It isn't doing anthing?


To reset that one text area:

$('#comment_comment').val('');
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号