1
$("#todos").append($("<%= escape_javascript(render("todo")) %>").find("form:eq[0]").children());

I'm sure the rendered partial has a form tag and it has child content, and yet, nothing gets added into #todos.

EDIT: Here's what is rendered by escape_javascript(render("todo"))

$("#todos").append($("<div class=\'todo\'>\n  <form accept-charset=\"UTF-8\" action=\"#\" class=\"new_todo\" id=\"new_todo\" method=\"post\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><input name=\"authenticity_token\" type=\"hidden\" value=\"5jeoteBl1GwCw6t4jllDRVuragGoRh3wiodOV8jMgOQ=\" /><\/div>\n    <p>make laundry<\/p>\n  <\/form>\n<\/div>\n").find("form:eq[0]").children());
randomguy
  • 12,042
  • 16
  • 71
  • 101

1 Answers1

2

MaybeMost probably it doesn't work because you used square brackets instead of round ones in find()

Should be

.find('form:eq(0)').children()
German Rumm
  • 5,782
  • 1
  • 25
  • 30