Firefox (only) Dynamic Form Action Not Working

2019-03-05 16:48发布

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条回答
该账号已被封号
2楼-- · 2019-03-05 17:16

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

查看更多
登录 后发表回答