Skip to content

Instantly share code, notes, and snippets.

@chyld
Created November 24, 2012 16:24
Show Gist options
  • Save chyld/4140364 to your computer and use it in GitHub Desktop.
Save chyld/4140364 to your computer and use it in GitHub Desktop.
//= require jquery
//= require jquery_ujs
//= require_tree .
$(function(){
$('#add_answer').click(add_answer);
});
function add_answer()
{
field = $('<div>');
field.addClass('field');
box = $('<input>');
box.attr('type', 'text');
box.attr('name', 'question[answers][][text]')
field.append(box);
cb = $('<input>');
cb.attr('type', 'checkbox');
cb.attr('name', 'question[answers][][correct]')
field.append(cb);
$('#answers').append(field);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment