Skip to content

Instantly share code, notes, and snippets.

@atomsfat atomsfat/fillform.js
Created Apr 24, 2017

Embed
What would you like to do?
fillcustomsform
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://cdn.rawgit.com/Marak/faker.js/master/examples/browser/js/faker.js';
script.onload = function() {
console.log("------>", faker, $("input[name='email']"))
window.randomData = function() {
// console.log("random data");
faker.locale = 'es_MX';
var firstName = faker.name.firstName(),
lastName = faker.name.lastName();
$("input[name='email']").attr("value", faker.internet.email(firstName, lastName));
$("input[name='firstName']").attr("value", firstName);
$("input[name='lastName_ap']").attr("value", lastName);
$("input[name='lastName_am']").attr("value", faker.name.lastName());
$("input[name='phone']").attr("value", faker.random.number(9999999999));
$("input[name='password']").attr("value", faker.internet.password());
$("input[name='calle']").attr("value", faker.address.city());
$("input[name='num_ext']").attr("value", faker.address.secondaryAddress());
$("input[name='codigo_postal']").attr("value", faker.random.number(99999));
$("input[name='colonia']").attr("value", faker.address.city());
$("input[name='estado']").attr("value", faker.address.state());
$("input[name='ciudad']").attr("value", faker.address.cityPrefix());
}
window.randomData();
}
head.appendChild(script);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.