RailsCasts Pro episodes are now free!

Learn more or hide this

Daniel's Profile

GitHub User: mostlybadfly

Site: http://www.mostlybadfly.com

Comments by Daniel

Avatar

Hello all, I'm currently following this guide and I'm running into a problem with the first remove answers step.

<%= f.label :content, "Answer" %>
<%= f.text_field :content %>
<%= f.hidden_field :_destroy %>
<%= link_to "remove", '#', class: "remove_fields" %>

jQuery ->
$('form').on 'click', '.remove_fields', (event) ->
$(this).prev('input[type=hidden]').val('1')
$(this).closest('fieldset').hide()
event.preventDefault()

when I go to test this and click on the "remove" link nothing is hidden. when I submit the form it doesn't remove the answer. Any thoughts?