Firefox(仅)动态表单操作不起作用 [英] Firefox (only) Dynamic Form Action Not Working

查看:134
本文介绍了Firefox(仅)动态表单操作不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

控制台返回空白的行动attr。我已经移动了:

  $('#file_upload')。attr('action','io.cfm?action = updateitemfile&安培; ITEM_ID = '+ $(' 议程模态。 ')ATTR。(' 数据defaultitemid')); 

.live('submit'),没有运气。我也试过,没有 + $('。agenda-modal')。attr('data-defaultitemid')部分,它仍然返回空白。我已经把我的表格中的所有内容都删除了:


$ b $ $ $ $('#file_upload')。live('submit',function ){
$(this).attr('action','io.cfm?action = updateitemfile& item_id ='+ $('。agenda-modal')。attr('data-defaultitemid'));
});

仍然没有任何结果。它提交到任何地方,并返回行动=



最后,它适用于所有其他浏览器,只是不是Firefox的:(有没有人有任何想法?

这里是HTML,以防万一你想看到它:

 < form id =file_uploadmethod =postenctype =multipart / form-datatarget =upload_targetaction => 
< br>< input type =submitname =actionvalue =Upload/>< br / >
< iframe id =upload_targetname =upload_targetsrc =style =display:none< / iframe>
< / form>
< code>


解决方案

基于 attr()文档上的这个注释,看起来这个动作必须大写才能在Firefox中工作:

  $('#file_upload')。live('submit',function(event){$ attr('data-defaultitemid')); b $ b $(this).attr('ACTION','io.cfm?action = updateitemfile& item_id ='+ $('。agenda-modal')。 
});

我有钱说,它在IE中打破...


Console is returning blank for the action attr. I've moved the:

$('#file_upload').attr('action','io.cfm?action=updateitemfile&item_id='+$('.agenda-modal').attr('data-defaultitemid'));

Around in and out of the .live('submit') and no luck. I also tried it without the +$('.agenda-modal').attr('data-defaultitemid') part and it still returns blank. Ive removed everything in my form to JUST:

$('#file_upload').live('submit',function(event){
        $(this).attr('action','io.cfm?action=updateitemfile&item_id='+$('.agenda-modal').attr('data-defaultitemid'));
});

and still nothing. It submits to nowhere, and returns action=""

Lastly, it works in all other browsers, just not Firefox :( Does anyone have any ideas?

Here is the HTML just in case you want to see it:

<form id="file_upload" method="post" enctype="multipart/form-data" target="upload_target" action="">
    <input name="binary" id="file" size="27" type="file" /><br />
    <br><input type="submit" name="action" value="Upload" /><br />
    <iframe id="upload_target" name="upload_target" src="" style="display:none"</iframe>
</form>

解决方案

Based on this comment on the attr() documentation, it appears that action must be capitalized to work in Firefox:

$('#file_upload').live('submit',function(event){
    $(this).attr('ACTION','io.cfm?action=updateitemfile&item_id='+$('.agenda-modal').attr('data-defaultitemid'));
});

I've got money that says that breaks it in IE...

这篇关于Firefox(仅)动态表单操作不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆