-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path00_Selectores.js
More file actions
59 lines (48 loc) · 1.67 KB
/
Copy path00_Selectores.js
File metadata and controls
59 lines (48 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
'use strict'
//$(document).ready(()=>{//el dolar resume la palabra JQuery
jQuery(document).ready(()=>{
//Selector de ID
$("#rojo").css("background","red")
.css("color","white")
.css("height","50px")
.css("text-align","center")
.css("font-size","40px");
$("#amarillo").css("background","yellow")
.css("height","50px")
.css("text-align","center")
.css("font-size","40px");
$("#verde").css("background","green")
.css("color","white")
.css("height","50px")
.css("text-align","center")
.css("font-size","40px");
//Selectores de clases
var cls = $(".zebra").css("padding","5px");
console.log(cls);
/*$('.sin-borde').click(function(){
console.log('me has dado click');
$(this).addClass('zebra');
});
*/
//Selectores de Etiquetas
var parrafos = $('p').css("cursor","pointer");
parrafos.click(function(){
var X = $(this);
if(X.hasClass('zebra')){
X.removeClass('zebra');
}else{
X.addClass('zebra');
}
});
//Selectores de Atributo
$('[title="Google"]').css('background','yellow');
$('[title="Facebook"]').css('background','blue');
$('[title="Youtube"]').css('background','red');
$('[title="Whatsapp"]').css('background','green');
$('[title="Github"]').css('background','black');
//seleccionando mas de un tipo
$('p , a').addClass('margen-superior');
//Como buscar una etiqueta dificil de encontrar
var busqueda = $("#caja").find('.resaltado');
console.log(busqueda);
});