基于jQuery的表单填充实例
投稿:jingxian
下面小编就为大家带来一篇基于jQuery的表单填充实例。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
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]);
}
以上这篇基于jQuery的表单填充实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持凡科。