3

I have radio buttons embedded in my form as

<%= f.radio_button :name_present,true,:class => "namePresent"%>
<%= f.radio_button :name_present,false,:class => "namePresent"%>

and my application.js file contains

$(".namePresent").live('click',function(e){

     $("#form").submit();
//form is the id of my form_for
 });

All parameters are passed in chrome, but in firefox parameter from radio buttons are not passed.

Apurva Mayank
  • 721
  • 2
  • 12
  • 32

1 Answers1

2

I should point out that live and bind are both deprecated. You can perform both with .on()

Try:

$(".namePresent").on('click',function(e){

   $("#form").submit();
//form is the id of my form_for
 });

Look at the link .

Community
  • 1
  • 1
Vik
  • 5,931
  • 3
  • 31
  • 38
  • Thanks Vik ...Its working fine on google chrome , but not on firefox and opera. Can there be any other reason for this.(Not tested on IE) – Apurva Mayank Apr 23 '12 at 14:01
  • Are you creating this dom dynamically ? Try this $(".namePresent").unbind('click').bind('click', function (ev){ ....YOUR_CODE }); – Vik Apr 23 '12 at 14:24