开发者

Firefox (only) Dynamic Form Action Not Working

开发者 https://www.devze.com 2023-01-10 15:16 出处:网络
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\'));

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 r开发者_Python百科eturns 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...

0

精彩评论

暂无评论...
验证码 换一张
取 消