Here is the coffee script that effects the behavior on radio buttons. Example can be found here: http://jsfiddle.net/ambiguous/Xk5ZC/
$(document).on 'change', '.stepRadio', ->
$container = $(@).closest('.stepCreator')
$container.find(".excelCreator, .videoCreator, .mcCreator").hide()
if @value is "video"
$container.find(".videoCreator").show()
else if @value is "excel"
$container.find(".excelCreator").show()
else if @value is "multiple_choice"
$container.find(".mcCreator").show()
# This initializes things. Since I have `:checked => true`
# on the first radio button, `:checked` will always match one
# radio button.
$('.stepRadio:checked').change()
Here is an attempt to translate the above to iCheck. However, I have problems on the last line of the code, in which I am trying to initalize the coffeescript.
$(document).on 'ifChecked', '.stepRadio', ->
$container = $(@).closest('.stepCreator')
$container.find(".excelCreator, .videoCreator, .mcCreator").hide()
if @value is "video"
$container.find(".videoCreator").show()
else if @value is "excel"
$container.find(".excelCreator").show()
else if @value is "multiple_choice"
$container.find(".mcCreator").show()
# This does not initialize things, as it should:
$('.stepRadio:checked').ifChecked()
I tried a couple of other things to initialize the code as well, such as
$('.stepRadio:checked').iCheck('check')
Nothing has worked.
Any help would be appreciated. Here is icheck: https://github.com/fronteed/iCheck
The last line I was looking for was :