附加文件输入不适用于ajaxfileupload
appending file inputs not working on ajaxfileupload
我正在使用一个名为ajaxfileupload的插件https://github.com/jfeldstein/jQuery.AjaxFileUpload.js
我的问题是,当我动态附加输入文件时,插件事件不会应用于新附加的输入文件。
这就是点击文件输入时调用插件的方式:
$("#mcq_option_list input[type=file], #question_name input[type=file], #test").ajaxfileupload({
这是我的附加函数:
$(this).before('<div class="answerswer_div"><input id="'+new_num+'" class="rb" type="radio" value="'+new_num+'"><label for="'+new_num+'" class="mc_label"><strong class="abcdWrapper">'+next_letter+'</strong></label><div class="fake-input"><input type="text" class="long_input" placeholder="Enter Sub Option here..." name="data[Quiz][option][]" autocomplete="off"><span></span><div class="inputWrapper"> Upload Image<input class="fileInput" type="file" name="data[Quiz][image]['+new_num+']" id="test"></div></div><a href="#" class="delete-scale-question"></a></div>');
感谢您提前提供的帮助。
我已经有了答案,我应该将所有内容都包含在"on"语句中。
这是完整的代码:
$("#mcq_contain").on("click", "#mcq_option_list input[type=file], #question_name input[type=file], #test", function(){
$(this).ajaxfileupload({
// Code goes here
});
});
相关文章:
- JQueryhide()不适用于Mozzilla,但适用于Chrome
- PHP中的setcookie仅适用于localhost
- html5 drawImage适用于firefox,而不是chrome
- 提供“;onClick"适用于iPad(触摸屏)和桌面用户的默认功能
- jQuery表单验证适用于Mozilla和Internet Explorer,但不适用于Chrome或Safari
- ResolveUrl是否适用于././也
- Firebase updateChildValues适用于IOS,但不适用于Web和Android
- JavaScript警报适用于int,但不适用于string
- SQLite插件适用于Mac和Windows,但不适用于手机上的Safari
- Regex Replace仅适用于Last Match
- window.onload适用于aspx页面,但不适用于普通html
- Jquery Ajax POST不工作.适用于GET
- 画布上的自定义字体仅适用于safari
- Javascript仅适用于alert()和Debug模式
- JS适用于Firefox和Safari,但不适用于Chrome.此处'是我的网站
- Regex不适用于Firefox,但适用于Chrome
- 通过单击主菜单外部关闭子菜单'不适用于IE,但适用于Firefox&铬
- AngularJS$http.post没有'不适用于Chrome,仅适用于IE
- Javascript仅适用于jQuery mobile中的页面刷新
- 关闭当前选项卡并打开一个新的-仅适用于Chrome