Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/445.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 单选按钮(带有click事件)未在firefox中传递参数_Javascript_Jquery_Ruby On Rails_Ruby On Rails 3_Ruby On Rails 3.1 - Fatal编程技术网

Javascript 单选按钮(带有click事件)未在firefox中传递参数

Javascript 单选按钮(带有click事件)未在firefox中传递参数,javascript,jquery,ruby-on-rails,ruby-on-rails-3,ruby-on-rails-3.1,Javascript,Jquery,Ruby On Rails,Ruby On Rails 3,Ruby On Rails 3.1,我的表单中嵌入了单选按钮 <%= f.radio_button :name_present,true,:class => "namePresent"%> <%= f.radio_button :name_present,false,:class => "namePresent"%> 所有参数都在chrome中传递,但在firefox中,单选按钮中的参数不会传递。我应该指出,live和bind都不推荐使用。您可以使用。on()执行这两项操作。 尝试: 查看(“

我的表单中嵌入了单选按钮

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

所有参数都在chrome中传递,但在firefox中,单选按钮中的参数不会传递。

我应该指出,livebind都不推荐使用。您可以使用。on()执行这两项操作。

尝试:


查看
(“#表单”).submit()中缺少的对不起,我的错误。但它是实际存在的代码。请不要将此代码放在application.js中。创建您自己的.js或更好地使用.coffee文件谢谢Vik…它在google chrome上运行良好,但在firefox和opera上不起作用。还有其他原因吗?(未在IE上测试)您是否动态创建此dom?试试这个$(“.namePresent”).unbind('click').bind('click',function(ev){……您的代码});
$(".namePresent").live('click',function(e){

     $("#form").submit();
//form is the id of my form_for
 });
$(".namePresent").on('click',function(e){

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