获取input的value值得 jQuery插件

插件内容:

(function($) {
$.fn.getRealInputValue = function() {
var params = {};

this.each(function() {
var placeholder = $(this).attr('myplaceholder');
var input = $(this);

if (input.hasClass('text-placeholder')) {
params[input.attr('name')] = '';
} else {
params[input.attr('name')] = input.val();
}
});

return params;
}
})(jQuery);

调用方式:

var params = $('form#invite-code-form :input').getRealInputValue();

原文地址:https://www.cnblogs.com/mabelstyle/p/2790424.html