JavaScript Error Correction: $(document).on('click', '.qmulimg', function() ... )
There are a few errors in your code. Here are the corrected lines:
-
Line 10: Change 'item_id' to 'data_id' in
var item_id = $(this).attr('data_id'); -
Line 12: Change
imgid.toString();toimgid.join(",");
Here is the corrected code:
$(document).on('click', '.qmulimg', function() {
var inputp = $(this);
$(this).remove();
var imgid = [];
inputp.closest('.qq_uploader').find('.qq_u_img').find('.qq_muti_img').each(function() {
var data_id = $(this).attr('data_id');
imgid.push(data_id);
});
var imgidlist = imgid.join(",");
inputp.closest('.qq_uploader').find('.q_uid_img').val(imgidlist);
});
Please note that this code assumes that you have the necessary HTML elements with the appropriate classes defined in your document.
原文地址: https://www.cveoy.top/t/topic/qk8S 著作权归作者所有。请勿转载和采集!