Skip to content

Commit 67098cd

Browse files
committed
SelectSimple
1 parent 32a2b25 commit 67098cd

File tree

2 files changed

+79
-2
lines changed

2 files changed

+79
-2
lines changed

Ejemplos/SelectSimple.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<h3>Select Simple JavaScript</h3>
11+
<form action="#" id="form">
12+
<input type="text" id="numero">
13+
<input type="submit" value="Submit">
14+
</form>
15+
16+
<script>
17+
document.querySelector('#form').addEventListener('submit',selectSimple);
18+
19+
function selectSimple(e){
20+
e.preventDefault();
21+
const select = document.getElementById('numero').value;
22+
console.log('El valor es : ' + select);
23+
}
24+
</script>
25+
</body>
26+
</html>

README.md

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,9 +823,60 @@ class Casa {
823823
const variable_id = document.getElementById('id');
824824

825825
```
826-
### Ejemplo
827826

828-
>#### HTML
827+
## Estructura - JavaScript Select Simple
828+
829+
>### HTML
830+
```html
831+
<form action="#" id="form">
832+
<input type="number" id="numero">
833+
<input type="submit" value="Submit">
834+
</form>
835+
```
836+
837+
>### JavaScript
838+
```js
839+
//Ya sabemos "apuntar" al elemento del cual queremos obtener el valor, la forma de obtenerlo es "muy sencilla".
840+
const variable_id = document.getElementById('numero').value;
841+
```
842+
843+
### Ejemplo completo
844+
```html
845+
846+
<!DOCTYPE html>
847+
<html lang="en">
848+
<head>
849+
<meta charset="UTF-8">
850+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
851+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
852+
<title>Document</title>
853+
</head>
854+
<body>
855+
<h3>Select Simple JavaScript</h3>
856+
<form action="#" id="form">
857+
<input type="text" id="numero">
858+
<input type="submit" value="Submit">
859+
</form>
860+
861+
<script>
862+
document.querySelector('#form').addEventListener('submit',selectSimple);
863+
864+
function selectSimple(e){
865+
e.preventDefault();
866+
const select = document.getElementById('numero').value;
867+
console.log('El valor es : ' + select);
868+
}
869+
</script>
870+
</body>
871+
</html>
872+
873+
```
874+
875+
876+
877+
## Estructura / Explicación - JavaScript Select Multiple
878+
879+
>#### HTML
829880
```html
830881
<form action="#" id="genero-form">
831882
<select id="genero">

0 commit comments

Comments
 (0)