zoukankan      html  css  js  c++  java
  • 基于jq的表单填充

     //表单填充
             formDataLoad: function (domId, obj) {
                for (var property in obj) {
                    if (obj.hasOwnProperty(property) == true) {
                        if ($("#" + domId + " [name='" + property + "']").size() > 0) {
                            $("#" + domId + " [name='" + property + "']").each(function () {
                                var dom = this;
                                if ($(dom).attr("type") == "radio") {
                                    $(dom).filter("[value='" + obj[property] + "']").attr("checked", true);
                                }
                                if ($(dom).attr("type") == "checkbox") {
                                    obj[property] == true ? $(dom).attr("checked", "checked") : $(dom).attr("checked", "checked").removeAttr("checked");
                                }
                                if ($(dom).attr("type") == "text" || $(dom).prop("tagName") == "SELECT" || $(dom).attr("type") == "hidden" || $(dom).attr("type") == "textarea") {
                                    $(dom).val(obj[property]);
                                }
                                if ($(dom).prop("tagName") == "TEXTAREA") {
                                    $(dom).val(obj[property]);
                                }
                            });
                        }
                    }
                }
            }
  • 相关阅读:
    python 模块包裹
    函数指针
    python界面
    python FileError
    python pickle
    python file
    python set
    python 字典的函数
    字典问题
    java学习笔记4
  • 原文地址:https://www.cnblogs.com/asylm/p/7405918.html
Copyright © 2011-2022 走看看