0

I have a code here in cofeescript to make a select all function in my list: in my view:

= submit_tag "Check All", :onclick => "checkUncheckAll(this, message_ids[])"

js.cofee:

toggle = (source) -> checkboxes = document.getElementsByName("user_message_ids[]") for i of checkboxes checkboxes[i].checked = source.checked

2
  • What is the question here? Can you explain more?
    – Samiron
    Aug 24, 2012 at 7:33
  • I just want to know how to make a select all function, this one is not working. Aug 24, 2012 at 7:40

1 Answer 1

0

First of all, use button_tag instead of submit_tag. Because submit_tag adds a type="submit" which is actually submit the form.

Secondly, This might help you to handle your checkboxes by cofeescript [ Programmatically check a checkbox using CoffeeScript ]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.