我很困惑为什么这不起作用。我希望声明一个以上的变量。我究竟做错了什么?
var message = (function ($) {
var $modalBody = $('.modal-body'),
$lblToUser = $modalBody.find('.to-user');
return {
toUser: function () {
$lblToUser.val('To');
$lblToUser.focus(function () {
if (this.value === 'To') this.value = '';
$(this).addClass('darker');
}).blur(function () {
if (this.value === '') this.value = 'To';
$(this).removeClass('darker');
});
},
};
})(jQuery);
message.toUser();