jQuery Select 自动选择默认值

时间:2014-12-17 16:03:26   收藏:0   阅读:316

//
//
// the Select target Auto Select value extension plugin
// 
// -------------------------------------------------------------------------- //
(function ($) {
$.extend($.fn, {

//
AutoSelect: function (options) {

// default options of plugin
var defaults = {
atr: "val",
filter: "select"
}

// deep copy $.extend(isDeepCopy,default_src,ext1,ext2,ext3,ext4,......);
var new_options = $.extend(true, defaults, options);

var $this = $(this);
$this.each(function () {
var $t = $(this);
// alert($t.prop("tagName".toLocaleUpperCase()));
if (new_options.filter.toLocaleUpperCase() != $t.prop("tagName")) {
$t.val($t.attr(defaults.atr));
}
})
}
});
})(jQuery);

 

原文:http://www.cnblogs.com/guizhouhehai/p/4169551.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!