I am trying to clear my form after I submit a link but I can't seem to get it to work.
links/_form.html.erb
<%= simple_form_for [question, Link.new], :remote => true, html: {id: "new_link"} do |f| %>
links/create.js.erb
$('.button').append("<%= j (render :partial => 'comments/newlink', locals: {question: @question}) %>");
$('#linkpartial').html("<%= j (render :partial => 'comments/newlink', locals: {question: @question}) %>");
$('#linkform').reset("<%= j (render :partial => 'links/form', locals: {question: @question}) %>");
$("#new_link").bind("ajax:complete", function(event,xhr,status){
$('.createcomment').val('');
}
controllers/links_controller.rb
def create
respond_to do |format|
if @link.save
format.html
format.js
end
end