سؤال

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