比如 $policy.idc_id 是通过 smart 模板获取的值
{{foreach from=$poinfo item=po}}
<input type="text" name="a_plus_{{$po.id}}" value={{$po.status}} maxlength="5"/>
{{if $po.status eq "1"}}
<th><p>开:</p><input type="radio" checked="checked" name="status_{{$po.id}}" value="1"/><p>关:</p><input type="radio" name="status_{{$po.id}}
" value="0" /></th>
{{else}}
<th><p>开:</p><input type="radio" name="status_{{$po.id}}" value="1" /><p>关:</p><input type="radio" checked="checked" name="status_{{$po.id}
}"value="0" /></th>
{{/if}}
{{/foreach}}
如何使用jquery 将input 表里面的name和 value 值存为数组,且 input type=ratio 只保留 checked="checked" 的name 和 value
请问如何实现
{{foreach from=$poinfo item=po}}
<input type="text" name="a_plus_{{$po.id}}" value={{$po.status}} maxlength="5"/>
{{if $po.status eq "1"}}
<th><p>开:</p><input type="radio" checked="checked" name="status_{{$po.id}}" value="1"/><p>关:</p><input type="radio" name="status_{{$po.id}}
" value="0" /></th>
{{else}}
<th><p>开:</p><input type="radio" name="status_{{$po.id}}" value="1" /><p>关:</p><input type="radio" checked="checked" name="status_{{$po.id}
}"value="0" /></th>
{{/if}}
{{/foreach}}
如何使用jquery 将input 表里面的name和 value 值存为数组,且 input type=ratio 只保留 checked="checked" 的name 和 value
请问如何实现
var arr=[];
$("input").each(function(){
if($(this).attr("type")=="radio"&&$(this).attr("checked")=="checked")
{
arr.push($(this).attr("name"));
arr.push($(this).attr("value"));
}
else
{
continue;
}
arr.push($(this).attr("name"));
arr.push($(this).attr("value"));
});
});随便写的,不一定管用。权当测试!