用 input 存取 x,y,z 这种类型字符串

var TitleInput = [];
                                                Today.find(".attractionDiv").each(function(){
                                                    $(this).find("div").each(function(){
                                                        TitleInput.push($(this).find("span").text());
                                                    })
                                                }) 
                                                Today.find("input[name='SettingTodayTitle[]']").val(unique(TitleInput));

  当你要 保存 x,y,z 这种字符串的时候,经常用到前端页面上的操作。

       这里要说的是,var TitleInput = [], 创建数组,然后给数组里添加元素,最后 赋值给 input 的时候,数组格式会自动转化成 上述格式。

原文地址:https://www.cnblogs.com/xie-xiao-chao/p/8118856.html