jQuery Select 自动选择默认值
//
//
// 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);