html - How to display something after a user input (submit) ? > HAML + RubyOnRails -


so im quite new ruby. have html/haml experience, want simple website this: input field , submit button.

if user input < 10 should display picture, if > 10, should display other picture. i've done far:

enter image description here

what should proccess user input ? can't figure out.

in case, not doing server side processing, should use javascript.

just check value of input field , logic there.

$('form').on('submit',function(){   if ($('#input1').val() < 10) {     $("#my_image").attr("src","first.jpg");   }    else {     $("#my_image").attr("src","second.jpg");   } })  

Comments