I want to create something like, when i select a value from a dropdown and clicked on submit button then a check box will be checked. For eg:

if (value of dropdown==1)

checkbox is checked

else

checkbox is not checked

can it possible in ROR? Thank you.

有帮助吗?

解决方案

Use JQuery,

$('#myform').submit(function( event ) {

  var selected_value = $('#Crd option:selected').text();

  if(selected_value == "myValue"){
    $('#my_check_box').prop('checked', true);
  }

}):
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top