{% extends "data_edit.html" %} {% block addjs %} $(function(){ var pid=$("#id_parent").val() var html=''; $("#id_parent").parent().html(html) $('#id_edit_form').validate({ rules: { "DeptID": {"digits":true,"minValue":1,"maxLength":5,"maxValue":65534} } }); {% if not add %} $('#id_DeptID').attr('readonly', true); {% endif %} }); {% endblock %}