I am trying to console log the 'options' argument but for some reason it only shows the first object? what and how can i make it console log all of the the objects inside the 'new validator'?
HTML
<form>
<input type="text" id="register_username">
<input type="password" id="register_password">
</form>
Javascript
var Validator = function (options) {
console.log(options);
};
var register_username = document.getElementById("register_username");
var register_password = document.getElementById("register_password");
document.getElementById("register_submit").addEventListener("click", function (e) {
e.preventDefault();
var register_val = new Validator(
{
element: register_username,
type: "str",
min: 1,
max: 20
},
{
element: register_password,
type: "str",
min: 4,
max: 20
}
);
}, false);
console log
element: <input id="register_username" class="register_username" placeholder="Username" name="register_username" autocomplete="off" type="text">
max: 20
min: 1
type: "str"
optionsargument since that one is the firstconsole.log(options)toconsole.log(arguments)and you'll print all passed args.