elink12,
как вариант ...
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
(function($, window, document) {
"use strict";
var pluginName = "test",
defaults = {
animation: "Y",
};
function Test (element, options, event) {
this.element = element;
this._init();
}
Test.prototype = {
_init: function () {
$(this.element).addClass('search-user form-control');
var inp = $('<input type="text" placeholder="Введите 2 символа" >')
$(this.element).append(inp);
inp.focus(function() {
$("body").trigger("testfocus");
})
},
};
$.fn.test = function(options,event) {
this.each(function(){
return new Test(this, options, event);
});
};
})(jQuery, window, document);
$( document ).ready(function() {
$(".title").test({animation:"Y"},event);
$("body").bind("testfocus", function(event){alert(123)});
});
</script>
</head>
<body>
<div class="title"></div>
</body>
</html>