xmlns,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
jQuery.fn.formValidation = function(options)
{
var settings =
{
fields: {
name: "name",
surname: "surname",
middlename: "middlename",
phoneNumber: "phoneNumber",
zipCode: "zipCode",
city: "city",
address: "address",
email: "email",
password1: "password1",
password2: "password2"
},
other: [], //[name, regExp, текст, положение tooltip]
tooltipPosition: "right"
};
//всякие приватные функции...
var methods = {
init: function(options)
{
alert(options.name); //выдает 0
settings = jQuery.extend(settings, options);
//тут идет код
},
validate: function()
{
alert(22222222222);
},
isEmpty: function()
{
alert(111111111111);
}
};
var make = function(method)
{
alert(method);
if(methods[method]) {
return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
}
else if(typeof method === 'object' || ! method ) {
return methods.init.apply(this, arguments);
}
else {
$.error('Метод с именем ' + method + ' не существует для jQuery.formValidation');
}
};
return this.each(function ()
{
make('init', options)
});
}
$({}).formValidation({name: "test"})
</script>
</head>
<body>
</body>
</html>