html radio check

发布时间:2016-12-31 7:23:39
来源:分享查询网

{% if classes|count > 1 %}    <div class="class_checkbox" id="class_checkbox">         <label class="class_checkbox_button">            <input type="radio" name="classes" value="" {{ 'checked' if not class_id}}>            全部        </label>        {% for c in classes %}        <label class="class_checkbox_button">            <input type="radio" name="classes" value="{{c['class_id']}}" {{ 'checked' if c['class_id'] == class_id}}>            {{c['name']}}        </label>        {% endfor %}    </div>    {% endif %}
$('#class_checkbox input[type="radio"]').change(function() {        var class_id = $("input[name='classes']:checked").val();        var path = window.location.pathname;        if(class_id){            path += '?class_id='+class_id;        }        window.location.href = path;    });

返回顶部
查看电脑版