jquery下將選擇的checkbox的id組成字符串的方法,需要的朋友可以參考下。
var colorValues = new Array(); $('#image-colors').find('.color-block').each(function(){ if($(this).find('span').eq(0).hasClass('selected')){ colorValues.push($(this).attr('title')); } }); var colorString = colorValues.join(','); alert(colorString);
新聞熱點
疑難解答
圖片精選