-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathselecting.js
31 lines (26 loc) · 1.12 KB
/
selecting.js
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
/* global document,$ */
class ExerciseSelecting {
constructor() {
}
selectingFun() {
//#1 //all of the div elements that have a class of "module"
var allDivsModule = $("div.module");
//#2 //get the third item in the #myList unordered list
var thirdMyListItem1 = $("#myListItem"); //this one being the most accurate since an ID is unique throughout the DOM and ID selectors are most efficient.
var thirdMyListItem2 = $("#myList").children("#myListItem");
var thirdMyListItem3 = $("#listItem_2").next();
var thirdMyListItem4 = $("li#myListItem").closest("li");
//#3 // label for the search input using an attribute selector.
var labelForSearch = $("label[for=q]");
//#4 //how many elements on the page are hidden
var findHidden = $("body").find(":hidden").length;
//#5 // image elements on the page have an alt attribute.
var noOfAltAttrib = $("img[alt]").length;
//#6 //all of the odd table rows in the table body
var oddTableTr = $("#fruits > tbody > tr:nth-child(odd)");
}
}
$(document).ready(function () {
var obj = new ExerciseSelecting();
obj.selectingFun();
});