Skip to content

Instantly share code, notes, and snippets.

@legarnica
Last active June 12, 2020 16:37
Show Gist options
  • Save legarnica/1aa329e615563ad9cea09d81fe050833 to your computer and use it in GitHub Desktop.
Save legarnica/1aa329e615563ad9cea09d81fe050833 to your computer and use it in GitHub Desktop.
faker-vanillajs-html-example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Facker</title>
</head>
<body>
<h3>Nombre: <span id="nombre"></span></h3>
<h3>Email: <span id="email"></span></h3>
<h3>Dirección: <span id="direccion"></span></h3>
<img id="avatar" alt="ramdom">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Faker/3.1.0/faker.min.js"></script>
<script>
document.querySelector('#nombre').innerHTML = faker.name.findName()
document.querySelector('#email').innerHTML = faker.internet.email()
document.querySelector('#direccion').innerHTML = faker.address.streetAddress()
document.querySelector('#avatar').setAttribute('src', faker.internet.avatar())
</script>
</body>
</html>
@legarnica
Copy link
Author

Ejemplo simple de uso de la librería Facker con js y html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment