/**取表单中的对象
    *attrName:为元素的的属性名称不设置则默认为name
    */
    $.fn.serialize = function (attrName) {
        var ret = {};
        if (!attrName) {attrName = "name";}

        $(this).find("*[" + attrName + "]").each(function (i, o) {
            var thisObj = $(o);
            var attrValue = thisObj.attr(attrName);

            var curValue = null;
            if (thisObj.is(":input")) {
                if (thisObj.is(".easyui-textbox"))
                    curValue=thisObj.textbox("getValue");
                else if (thisObj.is('.easyui-combobox'))
                    curValue=thisObj.combobox("getValue");
                else
                    curValue =thisObj.val();
            }
            else {
                curValue =thisObj.text();
            }
            ret[attrValue.split(".")[0]] = curValue;
        });

        return ret;
    };

 

相关文章:

  • 2021-11-25
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
  • 2021-08-29
  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
猜你喜欢
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2021-11-12
相关资源
相似解决方案