Firefox (only) Dynamic Form Action Not Working

孤街浪徒 提交于 2020-01-30 10:33:05

问题


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>

回答1:


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...



来源:https://stackoverflow.com/questions/3400816/firefox-only-dynamic-form-action-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!