So I have the following piece of code:
var structures = {
loginStructure : function(){
return structure = [
'<form name="',opts.formClass,'" class="',opts.formClass,'" method="post" action="#">',
'<fieldset class="',opts.fieldsWrapper,'">',
'<fieldset class="',opts.userWrapper,'">',
'<label for="',opts.userInt,'" class="',opts.userLbl,'"><img src="',opts.userIcon,'" alt="',opts.userName,'" /></label>',
'<input type="text" name="',opts.userInt,'" class="',opts.userInt,'" placeholder="',checkNameLenght(opts.userName,namesLenght.userNameLenght,16,'Username'),'" value="" autocomplete="off" />',
'</fieldset>',
'<fieldset class="',opts.passWrapper,'">',
'<label for="',opts.passInt,'" class="',opts.passLbl,'"><img src="',opts.passIcon,'" alt="',opts.passName,'" /></label>',
'<input type="password" name="',opts.passInt,'" class="',opts.passInt,'" placeholder="',checkNameLenght(opts.passName,namesLenght.passNameLenght,16,'Password'),'" value="" autocomplete="off" />',
'</fieldset>',
'<fieldset class="',opts.btnWrapper,'">',
'<button type="submit" name="',opts.btnInt,'" class="',opts.btnInt,'">',checkNameLenght(opts.btnName,namesLenght.btnNameLenght,7,'Login'),'</button>',
'</fieldset>',
'</fieldset>',
'<div class="toogle-button">',
'<ul class="inside">',
'<li class="toogle"><a><img src="assets/gfx/toogle.png" alt="Back" /></a></li>',
'</ul>',
'</div>',
'</form>',
'<div class="toogle-buttons">',
'</div>'
];
}
}
This returns ( if I do console.log(structures.loginStructure) ) just a function(). Is there a way I can make it to return the actual array I have in there ?
The purpose of it would be to have multiple arrays defined as object keys, if it is possible to return such a thing, because it seems easier. Or is there a better way to do this ?
$.fn.loginsys.defaults = { ... }. And if I run thatconsole.log()operation nothing shows up in this current state. If I had that object return a function as the first part of the answer says it shows as I describedfunction()in the console. So maybe something is wrong with my structure of the plugin and that is why it's not working properly. If you don't mind you could take a look jsfiddle.net/3fbZq/1 and tell me what's wrong.namesLenghtobject is not defined and thus it aborts. Also, do you realize that the normal spelling isnamesLengthnotnamesLenght. You can see the runnable version and the error here: jsfiddle.net/jfriend00/rdbfU.