Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <html lang="en">
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Vanilla js</title>
	<section id="container" class="otherClass">
		<h2 id="title">Hola mundo :) !</h2>
		<div id="texto"> 
				<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Inventore doloribus quis nobis, repellat nulla cumque, cum voluptatum perspiciatis non quo beatae dolorem quidem. Corporis nulla non labore dolores, maiores vero?</p>
	<ul id="lista">
		<li class="opt"><a href="">Opcion 1</a></li>
		<li class="opt"><a href="">Opcion 2</a></li>
		<li class="opt"><a href="">Opcion 3</a></li>
		<li class="opt"><a href="">Opcion 4</a></li>
		<li class="opt"><a href="">Opcion 5</a></li>
		<div id="salida"></div>




                // const mensaje = $('#container #title').text();

// $('#container #salida').text(mensaje);

// const mensajeVanilla = document.getElementById('title').textContent;
// document.getElementById('salida').textContent = mensajeVanilla;

// const texto = $('#container #texto').html();
// $('#container #salida').html(texto);

// const textVanilla = document.querySelector('#container #texto').innerHTML ;
// document.querySelector('#container #salida').innerHTML  = textVanilla;

// const element = document.querySelectorAll(".opt");
// document.querySelector('#container #salida').innerHTML  = element[0].innerHTML;

const length = 'John Serrano'.length;

const minusculas = "THE KIDS".toLowerCase();

const mayusculas = "I wish I were big.".toUpperCase();

const el = document.querySelector('#container');

/*  Revisamo si existen esas clases */
// alert(el.classList.contains("newClass")); 
// alert(el.classList.contains("otherClass"));

const list = document.querySelectorAll('#lista li');
// console.log(list)}
// Otra forma de hacerlo con map
/* callback(element, index) {
    console.log('ok todo bien', element);
list.forEach(function(currentValue, indice, array) {
	// podemos seleccionar cada elemento agregar clases, mas html, cambiar texto cualquier cosa se puede hacer con cada uno de los elementos.
  console.log("En el índice " + indice + " hay este valor: " + currentValue);
	El elemento actual siendo procesado en el array.
	El índice del elemento actual siendo procesado en el array.
	El arreglo en el que forEach esta siendo aplicado. */

/* $(selector).each(function(index,element));
Nota: Tener en cuenta el orden de los parametros en el callback */
$('#lista li').each(function(indice, valor){
	console.log('Hola soy el índice -> '+ indice + " hay este valor: " + valor);