💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
1.复选框是否选中 ~~~ {volist name="theme" id="vo"} <input type="checkbox" name="theme_id[]" title="{$vo.title}" value="{$vo.theme_id}" lay-skin="primary" {in name ="$vo.theme_id" value="$art.theme_id" } checked {/in}> {/volist} ~~~ 2.下拉框是否选中 ~~~ <select name="city_id" lay-verify="required" id="city"> <option value="">请选择城市</option> {volist name="city" id="vo"} <option {eq name="$art.city_id" value="$vo['config_id']"}selected{/eq} value="{$vo['config_id']}" >{$vo['value']}</option> {/volist} </select> ~~~ 3.复选框结果获取,并拼接成字符串 ~~~ function theme(){ var str=""; $('input[type=checkbox]:checked').each(function(){ str += $(this).val()+"," }); str = str.substring(0, str.lastIndexOf(','));//去除最后的‘,’; if(str===''){ str=0; } return str; } ~~~